SHARE
TWEET

Untitled

a guest Mar 20th, 2017 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const actions = {
  2.   login ({commit}, creds) { // need to commit here
  3.     commit('toggleLoading')
  4.     api.authenticate({
  5.       strategy: 'local',
  6.       ...creds
  7.     })
  8.     .then(function (result) {
  9.       return api.passport.verifyJWT(result.accessToken)
  10.     })
  11.     .then(function ({commit}, payload) {  //need to commit here
  12.       console.log(commit)
  13.       return api.service('users').get(payload.userId)
  14.       .subscribe(commit('setUser', user)) // need to commit here - but commit is not a function error
  15.     })
  16.     .catch(function ({commit}, error) {
  17.       commit('setErr', `ERROR AUTHENTICATING: {$err.message}`) // need to commit here but commit is not a function error
  18.       commit('toggleLoading')
  19.     })
  20.   }
RAW Paste Data
Top