fix(appointment): stop insurance select crash and use current endpoint
DefaultSelect passed options={undefined} to MUI Autocomplete while the
insurance lists were still loading (or failed), throwing 'Cannot read
properties of undefined (reading length)'. Default options to [].
The old categorys/insurance_type + supplementary_insurance routes were
removed server-side (ERR_MOVED), so the lists never loaded. Point
getInsuranceType/getSupplementaryInsurance at the current
/api/v1/insurances?type=basic|supplementary (authed; the booking detail
step and dashboard are both logged-in), returning a flat data array.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ function DefaultSelect({ list, value, updateData, label, error, name }) {
|
||||
return (
|
||||
<Autocomplete
|
||||
disablePortal
|
||||
options={list}
|
||||
options={Array.isArray(list) ? list : []}
|
||||
value={value || ""}
|
||||
getOptionLabel={(option) => {
|
||||
if (typeof option === "string") return option;
|
||||
|
||||
@@ -40,10 +40,10 @@ export const request = {
|
||||
patchUserProfile: (data, uuid) =>
|
||||
api.patch(`api/v1/user-profile/${uuid}`, data, { requireAuth: true }),
|
||||
getUserInfo: (headers) => api.get("oauth/userinfo", { ...headers, requireAuth: true }),
|
||||
getInsuranceType: (page = 1, limit = 10) =>
|
||||
api.get(`api/v1/categorys/insurance_type?page=${page}&limit=${limit}`, removeTokenHead),
|
||||
getSupplementaryInsurance: (page = 1, limit = 100) =>
|
||||
api.get(`api/v1/categorys/supplementary_insurance?page=${page}&limit=${limit}`, removeTokenHead),
|
||||
getInsuranceType: () =>
|
||||
api.get(`api/v1/insurances?type=basic`, { requireAuth: true }),
|
||||
getSupplementaryInsurance: () =>
|
||||
api.get(`api/v1/insurances?type=supplementary`, { requireAuth: true }),
|
||||
getDoctors: (params) =>
|
||||
api.get("api/v1/doctors", {
|
||||
params,
|
||||
|
||||
Reference in New Issue
Block a user