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