From 3f2fb0fdc335b096f0286a570bee0a33dacb6254 Mon Sep 17 00:00:00 2001 From: Giovanni-Josserand Date: Thu, 26 Mar 2026 10:19:46 +0100 Subject: [PATCH] create toggleEmailNotifications util method --- src/utils/users/toggleEmailNotifications.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/utils/users/toggleEmailNotifications.ts diff --git a/src/utils/users/toggleEmailNotifications.ts b/src/utils/users/toggleEmailNotifications.ts new file mode 100644 index 0000000..1fa8744 --- /dev/null +++ b/src/utils/users/toggleEmailNotifications.ts @@ -0,0 +1,13 @@ +import fetchWrapper from "../fetchWrapper"; +import getXSRFToken from "../getXSRF"; + +export default async function toggleEmailNotifications(id: number) { + const csrfToken = await getXSRFToken(); + + return fetchWrapper( + `/api/users/${id}/email-notifications`, + {}, + "PATCH", + { "X-XSRF-TOKEN": csrfToken } + ); +} \ No newline at end of file