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