20.02 Read Data when user Logs In
This commit is contained in:
parent
f84098008b
commit
e2dec4f1c6
@ -37,13 +37,14 @@ const actions = {
|
||||
logoutUser () {
|
||||
firebaseAuth.signOut()
|
||||
},
|
||||
handleAuthStateChange ({ commit }) {
|
||||
handleAuthStateChange ({ commit, dispatch }) {
|
||||
firebaseAuth.onAuthStateChanged(user => {
|
||||
Loading.hide()
|
||||
if (user) {
|
||||
commit('setLoggedIn', true)
|
||||
/* eslint handle-callback-err: "off" */
|
||||
this.$router.push('/').catch(err => {})
|
||||
dispatch('tasks/fbReadData', null, { root: true })
|
||||
} else {
|
||||
commit('setLoggedIn', false)
|
||||
this.$router.replace('/auth').catch(err => { })
|
||||
|
@ -66,6 +66,9 @@ const actions = {
|
||||
},
|
||||
setSort ({ commit }, value) {
|
||||
commit('setSort', value)
|
||||
},
|
||||
fbReadData ({ commit }) {
|
||||
console.log('read data from database')
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user