From da458550347e488105e735708c23ec682caa3ce4 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 30 Dec 2018 12:27:18 -0800 Subject: [PATCH] Use computed, not method so it is accessible --- resources/assets/scripts/components/auth/LoginForm.ts | 6 +++--- resources/assets/scripts/mixins/flash.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/assets/scripts/components/auth/LoginForm.ts b/resources/assets/scripts/components/auth/LoginForm.ts index 3ca24ec86..902094480 100644 --- a/resources/assets/scripts/components/auth/LoginForm.ts +++ b/resources/assets/scripts/components/auth/LoginForm.ts @@ -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); }); } }); diff --git a/resources/assets/scripts/mixins/flash.ts b/resources/assets/scripts/mixins/flash.ts index 9f5f7ad5a..49ddcb1c0 100644 --- a/resources/assets/scripts/mixins/flash.ts +++ b/resources/assets/scripts/mixins/flash.ts @@ -49,7 +49,7 @@ class Flash implements FlashInterface { } export const FlashMixin: ComponentOptions = { - methods: { + computed: { '$flash': function () { return new Flash(); }