This commit is contained in:
saeid
2019-05-06 21:48:46 +04:30
parent 5d8500dafd
commit f6d7277ddc
14 changed files with 268 additions and 168 deletions
+3 -3
View File
@@ -6,14 +6,14 @@ export default {
async login({ commit, dispatch }, {cell_number, password}) {
commit('loginRequest');
try {
const token = await UserService.login(cell_number, password);
commit('loginSuccess', token);
const response = await UserService.login(cell_number, password);
commit('loginSuccess', response.data.access_token);
// Redirect the user to the page he first tried to visit or to the home view
router.push(router.history.current.query.redirect || '/');
dispatch('info', {}, {root : true});
return true
return response;
} catch (e) {
if (e instanceof AuthenticationError) {
commit('loginError', {errorCode: e.errorCode, errorMessage: e.message})