Skip to content

Commit 72a054f

Browse files
committed
Fix: Cancel edit notifcaition settings
1 parent 5cc865f commit 72a054f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

course-matrix/frontend/src/pages/Home/EmailNotificationSettings.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ export const EmailNotificationSettings = ({
2828
const [updateTimetable] = useUpdateTimetableMutation();
2929
const [toggled, setToggled] = useState<boolean>(false);
3030

31+
const handleCancel = () => {
32+
setToggled((data as TimetableModel[])[0]?.email_notifications_enabled);
33+
}
34+
3135
useEffect(() => {
3236
if (data) {
3337
const val = (data as TimetableModel[])[0]?.email_notifications_enabled;
@@ -79,7 +83,7 @@ export const EmailNotificationSettings = ({
7983
</div>
8084
<DialogFooter>
8185
<DialogClose asChild>
82-
<Button variant="outline">Cancel</Button>
86+
<Button variant="outline" onClick={handleCancel}>Cancel</Button>
8387
</DialogClose>
8488
<DialogClose asChild>
8589
<Button onClick={handleUpdateEmailNotifications}>Save</Button>

0 commit comments

Comments
 (0)