refactor: enhance appointment flow by adding selected slot and date management across components

This commit is contained in:
hamed
2025-11-17 15:33:47 +03:30
parent 2777db3b8c
commit b46a017773
12 changed files with 135 additions and 44 deletions
+7 -1
View File
@@ -4,7 +4,7 @@ import Cookies from "js-cookie";
import { useParams } from "next/navigation";
import { useState } from "react";
function SendAppo({ hour, setStep }) {
function SendAppo({ hour, setStep, setSelectedSlot, date, setSelectedDate }) {
const params = useParams();
const doctorId = params.doctorId;
const [loading, setLoading] = useState(false);
@@ -12,6 +12,12 @@ function SendAppo({ hour, setStep }) {
const sendReq = () => {
const isLogged = Cookies.get("access_token");
// ذخیره کردن اطلاعات اسلات انتخاب شده
if (hour && date) {
setSelectedSlot(hour);
setSelectedDate(date);
}
if (isLogged) {
// اگر لاگین کرده، به مرحله 3 (Detail) می‌رود
setStep(3);