Created
May 12, 2019 18:23
-
-
Save jitinics/68d4a9feab26b69dcdd12ceff06129f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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