Merge branch '298-fix-clear-errors-resend-password-page' into 'master'

fix: Clear errors on resend password page.

Closes #298

See merge request framasoft/mobilizon!342
This commit is contained in:
Thomas Citharel 2019-12-15 22:22:08 +01:00
commit 60e95a6e36

View File

@ -5,7 +5,10 @@
<h1 class="title">
{{ $t('Password reset') }}
</h1>
<b-message title="Error" type="is-danger" v-for="error in errors" :key="error">{{ error }}</b-message>
<b-message
title="Error" type="is-danger" v-for="error in errors" :key="error" @close="removeError(error)">
{{ error }}
</b-message>
<form @submit="sendResetPasswordTokenAction" v-if="!validationSent">
<b-field label="Email">
<b-input aria-required="true" required type="email" v-model="credentials.email"/>
@ -59,6 +62,10 @@ export default class SendPasswordReset extends Vue {
this.credentials.email = this.email;
}
removeError(message: string) {
this.errors.splice(this.errors.indexOf(message))
}
async sendResetPasswordTokenAction(e) {
e.preventDefault();
@ -74,7 +81,9 @@ export default class SendPasswordReset extends Vue {
} catch (err) {
console.error(err);
err.graphQLErrors.forEach(({ message }) => {
this.errors.push(message);
if (this.errors.indexOf(message) < 0){
this.errors.push(message);
}
});
}
}