Files
nobat724_front/app/appointment/[doctorId]/page.js
T
hamedandClaude Opus 4.8 1d56972b65 fix: use SSL-tolerant axios instance for server-side API calls
صفحات سرور (doctors, doctor/[slug], appointment/[doctorId]) از axios خام
استفاده می‌کردند که گواهی self-signed ddev محلی را رد می‌کرد
(unable to verify the first certificate). حالا از axiosInstance/fetchReq
در lib/req استفاده می‌کنند که در development آن را می‌پذیرد.
افزودن clinic-pro.ddev.site (http/https) به remotePatterns تصاویر.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 00:21:34 +03:30

36 lines
976 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;
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 || [];
}
} catch (error) {}
return (
<AppointmentPage
doctor={doctor}
disabledDates={disabledDates}
matchedCity={matchedCity}
/>
);
}
export default Appointment;