From 58ee2e125a06b416645c5b00a4ca34fe1b03b0f6 Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:37:19 +0530 Subject: [PATCH] fix: Update the error response during changing the password from profile settings (#9114) --- .../routes/dashboard/settings/profile/ChangePassword.vue | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/javascript/dashboard/routes/dashboard/settings/profile/ChangePassword.vue b/app/javascript/dashboard/routes/dashboard/settings/profile/ChangePassword.vue index 8eb7201ae..99cee0325 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/profile/ChangePassword.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/profile/ChangePassword.vue @@ -74,6 +74,7 @@ import { required, minLength } from 'vuelidate/lib/validators'; import { mapGetters } from 'vuex'; import alertMixin from 'shared/mixins/alertMixin'; +import { parseAPIErrorResponse } from 'dashboard/store/utils/api'; export default { mixins: [alertMixin], @@ -125,10 +126,9 @@ export default { }); this.errorMessage = this.$t('PROFILE_SETTINGS.PASSWORD_UPDATE_SUCCESS'); } catch (error) { - this.errorMessage = this.$t('RESET_PASSWORD.API.ERROR_MESSAGE'); - if (error?.response?.data?.message) { - this.errorMessage = error.response.data.message; - } + this.errorMessage = + parseAPIErrorResponse(error) || + this.$t('RESET_PASSWORD.API.ERROR_MESSAGE'); } finally { this.isPasswordChanging = false; this.showAlert(this.errorMessage);