refactor: enhance appointment handling by adding appointmentId state and updating payment process
This commit is contained in:
@@ -5,7 +5,7 @@ import ArrowLeftB from "@/components/icons/ArrowLeftB";
|
||||
import { request } from "@/services/response";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
function SubmitData({ setStep, data, prevData, setErrors, doctor, selectedSlot, selectedDate }) {
|
||||
function SubmitData({ setStep, data, prevData, setErrors, doctor, selectedSlot, selectedDate, setAppointmentId }) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const newStep = () => setStep((prev) => prev + 1);
|
||||
|
||||
@@ -113,7 +113,10 @@ function SubmitData({ setStep, data, prevData, setErrors, doctor, selectedSlot,
|
||||
info: ""
|
||||
};
|
||||
|
||||
await request.postAppointment(appointmentPayload);
|
||||
const appointmentResponse = await request.postAppointment(appointmentPayload);
|
||||
if (appointmentResponse?.id) {
|
||||
setAppointmentId(appointmentResponse.id);
|
||||
}
|
||||
}
|
||||
|
||||
setLoading(false);
|
||||
|
||||
Reference in New Issue
Block a user