Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- signUserIn ({commit}, payload) {
- commit(types.SET_LOADING, true)
- commit(types.CLEAR_ERROR)
- firebase.auth().signInWithEmailAndPassword(payload.email, payload.password)
- .then((user) => {
- commit(types.SET_LOADING, false)
- const newUser = { id: user.uid, name: user.displayName, email: user.email, photoUrl: user.photoURL }
- commit(types.SET_USER, newUser)
- })
- .catch((error) => {
- commit(types.SET_LOADING, false)
- commit(types.SET_ERROR, error)
- })
- },
- this.$store.dispatch('signUserIn', { email: this.email, password: this.password })
- console.log('loading...: ', this.$store.getters.loading)
- this.$store.watch(this.$store.getters.loading, () => {
- console.log('loaded')
- console.log('onSIgnin error', this.error.code)
- })
- Error: [vuex] store.watch only accepts a function
- this.$store.dispatch('signUserIn', { email: this.email, password: this.password })
- console.log('loading...: ', this.$store.getters.loading)
- this.$store.watch((state, getters) => getters.loading, () => {
- console.log('loaded')
- console.log('onSIgnin error', this.error.code)
- })
Add Comment
Please, Sign In to add comment