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:
hamed
2026-06-15 16:41:17 +03:30
co-authored by Claude Opus 4.8
parent 65b3f56530
commit da3f20e07d
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -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;
+4 -4
View File
@@ -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,