fix: Reset loader state on error (#9597)

- Replace `showAlert` with `showAlertMessage` in auth related pages.
This commit is contained in:
Muhsin Keloth
2024-06-05 16:07:44 +05:30
committed by GitHub
parent c23e235cea
commit 839f7fe719
2 changed files with 10 additions and 8 deletions

View File

@@ -1,18 +1,18 @@
<template> <template>
<div <div
class="flex flex-col bg-woot-25 min-h-full w-full py-12 sm:px-6 lg:px-8 justify-center dark:bg-slate-900" class="flex flex-col justify-center w-full min-h-full py-12 bg-woot-25 sm:px-6 lg:px-8 dark:bg-slate-900"
> >
<form <form
class="sm:mx-auto sm:w-full sm:max-w-lg bg-white dark:bg-slate-800 p-11 shadow sm:shadow-lg sm:rounded-lg" class="bg-white shadow sm:mx-auto sm:w-full sm:max-w-lg dark:bg-slate-800 p-11 sm:shadow-lg sm:rounded-lg"
@submit.prevent="submit" @submit.prevent="submit"
> >
<h1 <h1
class="mb-1 text-left text-2xl font-medium tracking-tight text-slate-900 dark:text-white" class="mb-1 text-2xl font-medium tracking-tight text-left text-slate-900 dark:text-white"
> >
{{ $t('RESET_PASSWORD.TITLE') }} {{ $t('RESET_PASSWORD.TITLE') }}
</h1> </h1>
<p <p
class="text-sm text-slate-600 dark:text-woot-50 tracking-normal font-normal leading-6 mb-4" class="mb-4 text-sm font-normal leading-6 tracking-normal text-slate-600 dark:text-woot-50"
> >
{{ {{
useInstallationName( useInstallationName(
@@ -36,7 +36,7 @@
:loading="resetPassword.showLoading" :loading="resetPassword.showLoading"
/> />
</div> </div>
<p class="text-sm text-slate-600 dark:text-woot-50 mt-4 -mb-1"> <p class="mt-4 -mb-1 text-sm text-slate-600 dark:text-woot-50">
{{ $t('RESET_PASSWORD.GO_BACK_TO_LOGIN') }} {{ $t('RESET_PASSWORD.GO_BACK_TO_LOGIN') }}
<router-link to="/auth/login" class="text-link"> <router-link to="/auth/login" class="text-link">
{{ $t('COMMON.CLICK_HERE') }}. {{ $t('COMMON.CLICK_HERE') }}.
@@ -101,7 +101,7 @@ export default {
if (error?.response?.data?.message) { if (error?.response?.data?.message) {
errorMessage = error.response.data.message; errorMessage = error.response.data.message;
} }
this.showAlert(errorMessage); this.showAlertMessage(errorMessage);
}); });
}, },
}, },

View File

@@ -214,7 +214,7 @@ export default {
login(credentials) login(credentials)
.then(() => { .then(() => {
this.showAlert(this.$t('LOGIN.API.SUCCESS_MESSAGE')); this.showAlertMessage(this.$t('LOGIN.API.SUCCESS_MESSAGE'));
}) })
.catch(response => { .catch(response => {
// Reset URL Params if the authentication is invalid // Reset URL Params if the authentication is invalid
@@ -222,7 +222,9 @@ export default {
window.location = '/app/login'; window.location = '/app/login';
} }
this.loginApi.hasErrored = true; this.loginApi.hasErrored = true;
this.showAlert(response?.message || this.$t('LOGIN.API.UNAUTH')); this.showAlertMessage(
response?.message || this.$t('LOGIN.API.UNAUTH')
);
}); });
}, },
}, },