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