Skip to content

Commit 9fd6142

Browse files
committed
Merge branch 'kl/scrum-56-email-notifications' of https://github.com/UTSC-CSCC01-Software-Engineering-I/term-group-project-c01w25-project-course-matrix into kl/scrum-56-email-notifications
2 parents db06d57 + 346c903 commit 9fd6142

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 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,9 @@ export const EmailNotificationSettings = ({
7983
</div>
8084
<DialogFooter>
8185
<DialogClose asChild>
82-
<Button variant="outline">Cancel</Button>
86+
<Button variant="outline" onClick={handleCancel}>
87+
Cancel
88+
</Button>
8389
</DialogClose>
8490
<DialogClose asChild>
8591
<Button onClick={handleUpdateEmailNotifications}>Save</Button>

0 commit comments

Comments
 (0)