add failed login handling
This commit is contained in:
@@ -71,6 +71,7 @@
|
||||
@import '~bulma/sass/elements/button'
|
||||
@import '~bulma/sass/elements/form'
|
||||
@import '~bulma/sass/elements/icon'
|
||||
@import '~bulma/sass/elements/notification'
|
||||
@import '~bulma/sass/elements/other'
|
||||
@import '~bulma/sass/grid/columns'
|
||||
|
||||
|
||||
@@ -34,6 +34,11 @@
|
||||
</button>
|
||||
</p>
|
||||
|
||||
<div class="notification is-danger" v-if="badLogin">
|
||||
<button class="delete" @click="badLogin = false"></button>
|
||||
Login failed
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
@@ -54,6 +59,7 @@
|
||||
return {
|
||||
email: '',
|
||||
password: '',
|
||||
badLogin: false,
|
||||
sendTo: {},
|
||||
};
|
||||
},
|
||||
@@ -63,7 +69,11 @@
|
||||
|
||||
store.dispatch('userLogin', { email, password })
|
||||
.then(() => {
|
||||
this.badLogin = false;
|
||||
this.$router.push(this.sendTo);
|
||||
})
|
||||
.catch(() => {
|
||||
this.badLogin = true
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user