add an indicator on login
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
<span class="icon is-small">
|
<span class="icon is-small">
|
||||||
<i class="fa fa-key"></i>
|
<i class="fa fa-key"></i>
|
||||||
</span>
|
</span>
|
||||||
<button type="" class="button is-primary">
|
<button type="" class="button is-primary" :class="{ 'is-loading': pending }">
|
||||||
Login
|
Login
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
@@ -60,12 +60,16 @@
|
|||||||
email: '',
|
email: '',
|
||||||
password: '',
|
password: '',
|
||||||
badLogin: false,
|
badLogin: false,
|
||||||
|
pending: false,
|
||||||
sendTo: {},
|
sendTo: {},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
doLogin() {
|
doLogin() {
|
||||||
|
if (this.pending) return;
|
||||||
|
|
||||||
const { email, password } = this;
|
const { email, password } = this;
|
||||||
|
this.pending = true;
|
||||||
|
|
||||||
store.dispatch('userLogin', { email, password })
|
store.dispatch('userLogin', { email, password })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@@ -73,6 +77,7 @@
|
|||||||
this.$router.push(this.sendTo);
|
this.$router.push(this.sendTo);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
this.pending = false;
|
||||||
this.badLogin = true
|
this.badLogin = true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user