From da3f20e07d7e5f4c973f4bc97eca0a313e2b51fc Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Mon, 15 Jun 2026 16:41:17 +0330 Subject: [PATCH] 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 --- app/component/selectors/DefaultSelect.js | 2 +- services/response.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/component/selectors/DefaultSelect.js b/app/component/selectors/DefaultSelect.js index c017b3b..fd59a8f 100644 --- a/app/component/selectors/DefaultSelect.js +++ b/app/component/selectors/DefaultSelect.js @@ -6,7 +6,7 @@ function DefaultSelect({ list, value, updateData, label, error, name }) { return ( { if (typeof option === "string") return option; diff --git a/services/response.js b/services/response.js index fb5af0f..a2e7763 100644 --- a/services/response.js +++ b/services/response.js @@ -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,