adjust form submit,list, and detail

refactor(patient-preview): comment out unused occupation field in patient preview
fix(handler): return success response from update operation in crud handler
fix search patient
add handle del search char for ease use
This commit is contained in:
Khafid Prayoga
2025-12-11 14:15:24 +07:00
parent 8354d3819d
commit 3a4a2cc841
4 changed files with 19 additions and 6 deletions
+7 -1
View File
@@ -13,6 +13,11 @@ export async function getPatients(params: any = null) {
searchParams.append(key, params[key])
}
}
if (params.search) {
url += `/search/${params.search}`
searchParams.delete('search')
}
const queryString = searchParams.toString()
if (queryString) url += `?${queryString}`
}
@@ -42,7 +47,8 @@ export async function getPatientDetail(id: number) {
export async function getPatientByIdentifier(search: string) {
try {
const urlPath = search.length === 16 ? `by-resident-identity/search=${encodeURIComponent(search)}` : `/search/${search}`
const urlPath =
search.length === 16 ? `by-resident-identity/search=${encodeURIComponent(search)}` : `/search/${search}`
const url = `${mainUrl}/${urlPath}`
const resp = await xfetch(url, 'GET')
const result: any = {}