// Component: Login.vue
 data: () => ({
            credentials: {
                username: '',
                password: '',
            },
            errors: {},
            loading:false
        }),
methods : {
            login: function () {

                this.errors = {};
                this.loading = true;
                this.$store.dispatch('login', {credentials: this.credentials})
                    .then(() => {
                        this.loading = false;
                        this.$router.push('/');
                    })
                    .catch((e) => {

                        if (e.response.status == 422) {
                            this.errors = e.response.data.errors;
                        } else if (e.response.status == 401) {
                            this.errors.message = 'Kein Benutzer mit diesen Angaben gefunden.'
                        }

                        this.loading = false;
                    });
            }
        }