refactor: update appointment components to fetch and handle doctor data and disabled dates

This commit is contained in:
hamed
2025-11-12 21:28:15 +03:30
parent 573edc1eb9
commit 63d968be1e
11 changed files with 72 additions and 39 deletions
+2 -4
View File
@@ -1,7 +1,6 @@
"use client";
import { useEffect, useState } from "react";
import doctors from "@/data/doctors.json";
import { request } from "@/services/response";
import Cookies from "js-cookie";
import Container from "./Container";
@@ -13,9 +12,7 @@ const defaultData = {
basic_insurance: { value: "", isEdit: false },
};
function AppointmentPage({ slug, matchedCity }) {
const doctor = doctors.find((item) => item.id === +slug);
function AppointmentPage({ doctor, disabledDates, matchedCity }) {
const [step, setStep] = useState(0);
const [isForAnother, setIsForAnother] = useState(false);
@@ -78,6 +75,7 @@ function AppointmentPage({ slug, matchedCity }) {
matchedCity={matchedCity}
isForAnother={isForAnother}
setIsForAnother={setIsForAnother}
disabledDates={disabledDates}
/>
);
}