23.02 Clear the State after User Logs Out
This commit is contained in:
parent
47c282d94f
commit
45ac159e30
@ -35,7 +35,6 @@ const actions = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
logoutUser () {
|
logoutUser () {
|
||||||
console.log('xx')
|
|
||||||
firebaseAuth.signOut()
|
firebaseAuth.signOut()
|
||||||
},
|
},
|
||||||
handleAuthStateChange ({ commit, dispatch }) {
|
handleAuthStateChange ({ commit, dispatch }) {
|
||||||
@ -47,6 +46,7 @@ const actions = {
|
|||||||
this.$router.push('/').catch(err => {})
|
this.$router.push('/').catch(err => {})
|
||||||
dispatch('tasks/fbReadData', null, { root: true })
|
dispatch('tasks/fbReadData', null, { root: true })
|
||||||
} else {
|
} else {
|
||||||
|
commit('tasks/clearTasks', null, { root: true })
|
||||||
commit('setLoggedIn', false)
|
commit('setLoggedIn', false)
|
||||||
commit('/tasks/setTasksDownloaded', false, { root: true })
|
commit('/tasks/setTasksDownloaded', false, { root: true })
|
||||||
this.$router.replace('/auth').catch(err => { })
|
this.$router.replace('/auth').catch(err => { })
|
||||||
|
@ -40,6 +40,9 @@ const mutations = {
|
|||||||
addTask (state, payload) {
|
addTask (state, payload) {
|
||||||
Vue.set(state.tasks, payload.id, payload.task)
|
Vue.set(state.tasks, payload.id, payload.task)
|
||||||
},
|
},
|
||||||
|
clearTasks (state) {
|
||||||
|
state.tasks = {}
|
||||||
|
},
|
||||||
setSearch (state, value) {
|
setSearch (state, value) {
|
||||||
state.search = value
|
state.search = value
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user