fix: doctor toggle logic

This commit is contained in:
Kailasdevdas
2026-05-13 14:19:42 +05:30
parent 199797fdf4
commit 988fbd28f1
3 changed files with 47 additions and 34 deletions
+8 -2
View File
@@ -158,8 +158,14 @@ export default function DoctorPage() {
const handleToggleStatus = async (doc: any) => {
try {
const updatedDoc = { ...doc, isActive: !doc.isActive };
await updateDoctorApi(doc.doctorId, updatedDoc);
const newStatus = !doc.isActive;
const payload = {
isActive: newStatus,
};
await updateDoctorApi(doc.doctorId, payload);
fetchAll();
} catch (err) {
console.error("Failed to update status", err);