Skip to content

Instantly share code, notes, and snippets.

@jitinics
Created May 12, 2019 18:23
Show Gist options
  • Save jitinics/68d4a9feab26b69dcdd12ceff06129f2 to your computer and use it in GitHub Desktop.
Save jitinics/68d4a9feab26b69dcdd12ceff06129f2 to your computer and use it in GitHub Desktop.
import userProvider from '../resource/UserProvider'
const loginModule = {
namespaced: true,
state: {
userData: {}
},
mutations: {
SET_USER_DATA (state, data) {
state.userData = data
}
},
actions: {
login: async ({ commit }, {email, password}) => {
const result = await userProvider.signIn(email, password)
commit('SET_USER_DATA', result.data)
}
},
getters: {
getUserData: (state) => {
return state.userData
}
}
}
export default loginModule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment