Add logout button.
This commit is contained in:
parent
b284689313
commit
7d59051fc5
15 changed files with 45 additions and 19 deletions
|
@ -29,6 +29,9 @@ export default {
|
|||
},
|
||||
scrollToTop () {
|
||||
window.scrollTo(0, 0)
|
||||
},
|
||||
logout () {
|
||||
this.$store.dispatch('logout')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<div class='item right'>
|
||||
<user-finder></user-finder>
|
||||
<router-link :to="{ name: 'settings'}"><i class="icon-cog"></i></router-link>
|
||||
<a href="#" v-if="currentUser" @click.prevent="logout"><i class="icon-logout" title="Logout" ></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -26,6 +26,9 @@ export const mutations = {
|
|||
setCurrentUser (state, user) {
|
||||
state.currentUser = merge(state.currentUser || {}, user)
|
||||
},
|
||||
clearCurrentUser (state) {
|
||||
state.currentUser = false
|
||||
},
|
||||
beginLogin (state) {
|
||||
state.loggingIn = true
|
||||
},
|
||||
|
@ -66,6 +69,11 @@ const users = {
|
|||
store.commit('setUserForStatus', status)
|
||||
})
|
||||
},
|
||||
logout (store) {
|
||||
store.commit('clearCurrentUser')
|
||||
store.dispatch('stopFetching', 'friends')
|
||||
store.commit('setBackendInteractor', backendInteractorService())
|
||||
},
|
||||
loginUser (store, userCredentials) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const commit = store.commit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue