From 386fc454feba2985a6e5d693956cdf52c49cff73 Mon Sep 17 00:00:00 2001 From: Trenton Zimmer <66042448+trmazi@users.noreply.github.com> Date: Thu, 24 Oct 2024 02:10:27 -0400 Subject: [PATCH] Add box and layout for card adding, finish password resetting. --- src/stores/api/account.js | 18 ++++++++++++ src/stores/main.js | 6 ++++ src/views/Profile/CardsView.vue | 49 +++++++++++++++++++++++++++++-- src/views/Profile/ProfileView.vue | 48 ++++++++++++++++++------------ 4 files changed, 101 insertions(+), 20 deletions(-) diff --git a/src/stores/api/account.js b/src/stores/api/account.js index bb30242..6b1e826 100644 --- a/src/stores/api/account.js +++ b/src/stores/api/account.js @@ -38,3 +38,21 @@ export async function APIResetPassword(key, newPassword, confirmPassword) { throw error; } } + +export async function APIUpdatePassword( + currentPassword, + newPassword, + confirmPassword +) { + try { + const data = await mainStore.callApi(`/user/updatePassword`, "POST", { + currentPassword: currentPassword, + newPassword: newPassword, + confirmPassword: confirmPassword, + }); + return data; + } catch (error) { + console.log("Error updating password:", error); + throw error; + } +} diff --git a/src/stores/main.js b/src/stores/main.js index c246db8..b3ee699 100644 --- a/src/stores/main.js +++ b/src/stores/main.js @@ -122,6 +122,12 @@ export const useMainStore = defineStore("main", { this.isLoading = true; return null; } + if (response.data.status === "warn") { + alert(response.data.error_code); + this.isSaving = false; + this.isLoading = false; + return null; + } this.isLoading = false; // reset flags this.isSaving = false; return response.data; diff --git a/src/views/Profile/CardsView.vue b/src/views/Profile/CardsView.vue index 907d5b3..74fbaa7 100644 --- a/src/views/Profile/CardsView.vue +++ b/src/views/Profile/CardsView.vue @@ -1,10 +1,17 @@