Files
nobat724_front/app/appointment/[doctorId]/page.js
T
hamedandClaude Opus 4.8 0e112d2299 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 <noreply@anthropic.com>
2026-06-15 15:37:47 +03:30

27 lines
663 B
JavaScript

import AppointmentPage from "@/components/appointment";
import { getStateInfo } from "@/lib/getStateInfo";
import { axiosInstance } from "@/lib/req";
async function Appointment({ params }) {
const { doctorId } = await params;
const { matchedCity } = await getStateInfo();
const API_URL = process.env.NEXT_PUBLIC_API_URL;
let doctor = null;
try {
const doctorRes = await axiosInstance.get(`${API_URL}/api/v1/doctor/${doctorId}`);
doctor = doctorRes.data?.data?.data;
} catch (error) {}
return (
<AppointmentPage
doctor={doctor}
disabledDates={[]}
matchedCity={matchedCity}
/>
);
}
export default Appointment;