diff --git a/src/views/UserProfile.vue b/src/views/UserProfile.vue index a68a6a4b1e8cbf3c0c8c8c2f5c81384340ed0fc7..a0aca6264cc267603c649180f8189ebcfdd7ba53 100644 --- a/src/views/UserProfile.vue +++ b/src/views/UserProfile.vue @@ -839,14 +839,14 @@ export default { }); }, - submitNewPassword() { - const data = { - password: this.formPassword.password, - new_password: this.formPassword.newPassword2 - }; - this.loadingUserPassword = true; - this.UPDATE_USER_DETAIL(data) - .then(() => { + async submitNewPassword() { + try { + this.loadingUserPassword = true; + const data = { + password: this.formPassword.password, + new_password: this.formPassword.newPassword2 + }; + await this.UPDATE_USER_DETAIL(data); this.loadingUserPassword = false; if (this.success && this.success.length) { Swal.fire({ @@ -865,7 +865,10 @@ export default { } }); } - }); + } catch (err) { + console.error(err); + this.loadingUserPassword = false; + } } }