From 9762c915657c354a560db818767cd10a91d20623 Mon Sep 17 00:00:00 2001 From: Giovanni-Josserand Date: Sat, 28 Mar 2026 18:04:13 +0100 Subject: [PATCH] create updateUserPassword util --- src/utils/users/updateUserPassword.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/utils/users/updateUserPassword.ts diff --git a/src/utils/users/updateUserPassword.ts b/src/utils/users/updateUserPassword.ts new file mode 100644 index 0000000..7d7ceb3 --- /dev/null +++ b/src/utils/users/updateUserPassword.ts @@ -0,0 +1,12 @@ +import fetchWrapper from "../fetchWrapper"; +import getXSRFToken from "../getXSRF"; + +export default async function updateUserPassword(current_password: string, new_password: string, new_password_confirmation: string) { + const csrfToken = await getXSRFToken(); + return fetchWrapper( + "/api/users/update/password", + { current_password, new_password, new_password_confirmation }, + "POST", + { "X-XSRF-TOKEN": csrfToken } + ); +} \ No newline at end of file