From ad3e6e59f2c2501d7e5e631517e217d79459a066 Mon Sep 17 00:00:00 2001 From: James Collins Date: Tue, 28 Feb 2023 08:51:37 +1000 Subject: [PATCH] fix logic --- .../dialogs/SMDialogChangePassword.vue | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/resources/js/components/dialogs/SMDialogChangePassword.vue b/resources/js/components/dialogs/SMDialogChangePassword.vue index 8b63412..373264f 100644 --- a/resources/js/components/dialogs/SMDialogChangePassword.vue +++ b/resources/js/components/dialogs/SMDialogChangePassword.vue @@ -61,33 +61,32 @@ const handleClickCancel = () => { * User clicks form submit button */ const handleSubmit = async () => { - dialogLoading.value = true; + try { + dialogLoading.value = true; - api.put({ - url: "/users/{id}", - params: { - id: userStore.id, - }, - body: { - password: form.controls.password.value, - }, - }) - .then(() => { - const toastStore = useToastStore(); - - toastStore.addToast({ - title: "Password Reset", - content: "Your password has been reset", - type: "success", - }); - closeDialog(false); - }) - .catch((error) => { - form.apiErrors(error); - }) - .finally(() => { - dialogLoading.value = false; + await api.put({ + url: "/users/{id}", + params: { + id: userStore.id, + }, + body: { + password: form.controls.password.value, + }, }); + + const toastStore = useToastStore(); + + toastStore.addToast({ + title: "Password Reset", + content: "Your password has been reset", + type: "success", + }); + closeDialog(false); + } catch (error) { + form.apiErrors(error); + } finally { + dialogLoading.value = false; + } }; /**