Use computed, not method so it is accessible

This commit is contained in:
Dane Everitt 2018-12-30 12:27:18 -08:00
parent 75ba2eac39
commit da45855034
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 4 additions and 4 deletions

View file

@ -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);
});
}
});

View file

@ -49,7 +49,7 @@ class Flash implements FlashInterface {
}
export const FlashMixin: ComponentOptions<Vue> = {
methods: {
computed: {
'$flash': function () {
return new Flash();
}