Torsten Teubner
1 min readDec 9, 2017

--

Hello Gareth,

thank you very much for sharing.
This helps me a lot, get my authentication running, because before that I could only login, but the state was gone after reload.

I have made a little improvment for the Firebase call.
I´ve put it into the store too.
As seen in this tutorial from Max.

This in store.js:

actions: {
setUser: context => {
context.commit('setUser')
},
signUserIn ({ commit }, payload) {
Firebase.auth()
.signInWithEmailAndPassword(payload.email, payload.password)
.then(newUser => {
commit('setUser', newUser)
})
.catch(error => {
console.log(error.message)
})
}

and in signup.vue I call it this way

onSignin () {
this.$store.dispatch('signUserIn', { email: this.newUser.email, password: this.newUser.password })
}

Torsten

--

--