From 1f070102bfcebe10bae6e63d34bb1723e072378a Mon Sep 17 00:00:00 2001 From: Alex Erdei Date: Wed, 7 May 2025 20:26:35 +0100 Subject: [PATCH] Make password changing email work --- src/backend/backend.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/backend/backend.js b/src/backend/backend.js index 2500ff7..8f7978f 100644 --- a/src/backend/backend.js +++ b/src/backend/backend.js @@ -38,6 +38,8 @@ const MSG_URL = `${API}/message`; const IMAGE_URL = `${API}/image`; +const PWD_URL = `${API}/pswreminder`; // GET ?email= + const LS_TOKEN = "fakebook.jwt"; const LS_UID = "fakebook.user_id"; @@ -291,11 +293,19 @@ export const signUserOut = async () => { // password reminder ------------------------------------------------------ export const sendPasswordReminder = async (email) => { - // no real endpoint yet – stub keeps call-sites happy + store.dispatch(loadingStarted()); - console.info("[TODO] send password reminder for", email); + try { + await $fetch(`${PWD_URL}?email=${encodeURIComponent(email)}`, { + method: "GET", + }); - return Promise.resolve(); + store.dispatch(errorOccured("")); // clear old errors + } catch (e) { + store.dispatch(errorOccured(e.message)); + } + + store.dispatch(loadingFinished()); }; // users subscription -----------------------------------------------------