refactor: enhance appointment flow by adding selected slot and date management across components
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user