Use computed, not method so it is accessible
This commit is contained in:
parent
75ba2eac39
commit
da45855034
2 changed files with 4 additions and 4 deletions
|
@ -26,7 +26,6 @@ export default Vue.component('login-form', {
|
|||
// Handle a login request eminating from the form. If 2FA is required the
|
||||
// user will be presented with the 2FA modal window.
|
||||
submitForm: function () {
|
||||
const self = this;
|
||||
this.$data.showSpinner = true;
|
||||
|
||||
this.$flash.clear();
|
||||
|
@ -47,13 +46,14 @@ export default Vue.component('login-form', {
|
|||
this.$store.commit('auth/logout');
|
||||
|
||||
if (!err.response) {
|
||||
this.$flash.error('There was an error with the network request. Please try again.');
|
||||
return console.error(err);
|
||||
}
|
||||
|
||||
const response = err.response;
|
||||
if (response.data && isObject(response.data.errors)) {
|
||||
response.data.errors.forEach(function (error: any) {
|
||||
self.$flash.error(error.detail);
|
||||
response.data.errors.forEach((error: any) => {
|
||||
this.$flash.error(error.detail);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -49,7 +49,7 @@ class Flash implements FlashInterface {
|
|||
}
|
||||
|
||||
export const FlashMixin: ComponentOptions<Vue> = {
|
||||
methods: {
|
||||
computed: {
|
||||
'$flash': function () {
|
||||
return new Flash();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue