From 0e112d2299701329f23be081945bc9b0e8f1aafb Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Mon, 15 Jun 2026 15:37:47 +0330 Subject: [PATCH] fix(appointment): unwrap doctor response and drop dead not-available call The doctor endpoint is triple-nested, so doctorRes.data left doctor.id undefined and the booking page received a broken doctor object. Extract with data?.data?.data and remove the disabledDates fetch to the nonexistent /appointment/not-available route (404); pass [] so the date picker enables all dates and lets the slots response gate availability. Co-Authored-By: Claude Opus 4.8 --- app/appointment/[doctorId]/page.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/app/appointment/[doctorId]/page.js b/app/appointment/[doctorId]/page.js index dfcb639..f4ff9c0 100644 --- a/app/appointment/[doctorId]/page.js +++ b/app/appointment/[doctorId]/page.js @@ -8,25 +8,16 @@ async function Appointment({ params }) { const API_URL = process.env.NEXT_PUBLIC_API_URL; let doctor = null; - let disabledDates = []; try { const doctorRes = await axiosInstance.get(`${API_URL}/api/v1/doctor/${doctorId}`); - doctor = doctorRes.data; - - if (doctor && doctor.id) { - const disabledDatesRes = await axiosInstance.get( - `${API_URL}/api/v1/appointment/not-available/${doctor.id}`, - { headers: { "Content-Type": "application/json" } } - ); - disabledDates = disabledDatesRes.data?.data || []; - } + doctor = doctorRes.data?.data?.data; } catch (error) {} return ( );