add logout handling
This commit is contained in:
@@ -22,6 +22,9 @@
|
|||||||
<router-link class="nav-item is-tab" :to="{ name: 'about' }" active-class="is-active">
|
<router-link class="nav-item is-tab" :to="{ name: 'about' }" active-class="is-active">
|
||||||
About
|
About
|
||||||
</router-link>
|
</router-link>
|
||||||
|
<a class="nav-item is-tab" @click="logout">
|
||||||
|
Logout
|
||||||
|
</a>
|
||||||
<span class="nav-item">
|
<span class="nav-item">
|
||||||
<a class="button" >
|
<a class="button" >
|
||||||
<span class="icon"><i class="fa fa-github"></i></span>
|
<span class="icon"><i class="fa fa-github"></i></span>
|
||||||
@@ -46,6 +49,12 @@
|
|||||||
components: {
|
components: {
|
||||||
TopNav,
|
TopNav,
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
logout() {
|
||||||
|
store.dispatch('userLogout')
|
||||||
|
.then(() => this.$router.push({ name: 'login' }));
|
||||||
|
}
|
||||||
|
},
|
||||||
// pre-route auth checking
|
// pre-route auth checking
|
||||||
beforeRouteEnter(to, from, next) {
|
beforeRouteEnter(to, from, next) {
|
||||||
// if user is authenticated, continue
|
// if user is authenticated, continue
|
||||||
|
|||||||
Reference in New Issue
Block a user