Guest User

Untitled

a guest
Jun 19th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. signUserIn ({commit}, payload) {
  2. commit(types.SET_LOADING, true)
  3. commit(types.CLEAR_ERROR)
  4. firebase.auth().signInWithEmailAndPassword(payload.email, payload.password)
  5. .then((user) => {
  6. commit(types.SET_LOADING, false)
  7. const newUser = { id: user.uid, name: user.displayName, email: user.email, photoUrl: user.photoURL }
  8. commit(types.SET_USER, newUser)
  9. })
  10. .catch((error) => {
  11. commit(types.SET_LOADING, false)
  12. commit(types.SET_ERROR, error)
  13. })
  14. },
  15.  
  16. this.$store.dispatch('signUserIn', { email: this.email, password: this.password })
  17. console.log('loading...: ', this.$store.getters.loading)
  18. this.$store.watch(this.$store.getters.loading, () => {
  19. console.log('loaded')
  20. console.log('onSIgnin error', this.error.code)
  21. })
  22.  
  23. Error: [vuex] store.watch only accepts a function
  24.  
  25. this.$store.dispatch('signUserIn', { email: this.email, password: this.password })
  26. console.log('loading...: ', this.$store.getters.loading)
  27. this.$store.watch((state, getters) => getters.loading, () => {
  28. console.log('loaded')
  29. console.log('onSIgnin error', this.error.code)
  30. })
Add Comment
Please, Sign In to add comment