Hi All, pls I need your direction on the issue I have below.
We use the Firebase Observer to remember that a user has logged in to our App. See below.
firebase.auth().onAuthStateChanged(function (user) {
console.log(‘user in app.js’, user)
if (user != null) {
console.log('check in app.js')
if (user.emailVerified) {
store.commit('setSignedIn', true)
store.commit('setDisplayName', user.displayName)
store.commit('setPhotoURL', user.photoURL)
} else {
// No user is signed in.
store.commit('setSignedIn', false)
}
}
})
For some reason, we don’t want to use Firebase Observer anymore to remember user login status.
In the app.vue, the user login status can be determined
computed:{
signed_in() {
return this.$store.getters.signed_in;
},
}
How can I reference this within app.js?
I tried below but got undefined for signed_in:
if (store.signed_in) {
store.commit(‘setSignedIn’, true)
}
I am opened to any logic that can work to capture user login status within the app.js.
Thanks