feat(encounter): update ui cancellation + integration
This commit is contained in:
@@ -86,3 +86,16 @@ export async function remove(path: string, id: number | string, name: string = '
|
||||
throw new Error(`Failed to delete ${name}`)
|
||||
}
|
||||
}
|
||||
|
||||
export async function custom(path: string, data: any, name: string = 'item') {
|
||||
try {
|
||||
const resp = await xfetch(`${path}`, 'PATCH', data)
|
||||
const result: any = {}
|
||||
result.success = resp.success
|
||||
result.body = (resp.body as Record<string, any>) || {}
|
||||
return result
|
||||
} catch (error) {
|
||||
console.error(`Error putting ${name}:`, error)
|
||||
throw new Error(`Failed to put ${name}`)
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ export function remove(id: number | string) {
|
||||
|
||||
export function cancel(id: number | string) {
|
||||
let url = `${path}/${id}/cancel`
|
||||
return base.update(url, id, {}, name)
|
||||
return base.custom(url, null, name)
|
||||
}
|
||||
|
||||
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
|
||||
|
||||
Reference in New Issue
Block a user