Skip to content

Commit da45855

Browse files
committed
Use computed, not method so it is accessible
1 parent 75ba2ea commit da45855

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

resources/assets/scripts/components/auth/LoginForm.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export default Vue.component('login-form', {
2626
// Handle a login request eminating from the form. If 2FA is required the
2727
// user will be presented with the 2FA modal window.
2828
submitForm: function () {
29-
const self = this;
3029
this.$data.showSpinner = true;
3130

3231
this.$flash.clear();
@@ -47,13 +46,14 @@ export default Vue.component('login-form', {
4746
this.$store.commit('auth/logout');
4847

4948
if (!err.response) {
49+
this.$flash.error('There was an error with the network request. Please try again.');
5050
return console.error(err);
5151
}
5252

5353
const response = err.response;
5454
if (response.data && isObject(response.data.errors)) {
55-
response.data.errors.forEach(function (error: any) {
56-
self.$flash.error(error.detail);
55+
response.data.errors.forEach((error: any) => {
56+
this.$flash.error(error.detail);
5757
});
5858
}
5959
});

resources/assets/scripts/mixins/flash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Flash implements FlashInterface {
4949
}
5050

5151
export const FlashMixin: ComponentOptions<Vue> = {
52-
methods: {
52+
computed: {
5353
'$flash': function () {
5454
return new Flash();
5555
}

0 commit comments

Comments
 (0)