Add logout button.

This commit is contained in:
Roger Braun 2017-07-02 12:25:34 +02:00
parent b284689313
commit 7d59051fc5
15 changed files with 45 additions and 19 deletions

View file

@ -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