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