|
@ -30,7 +30,7 @@ export default createStore({ |
|
|
data: qs.stringify({...user}) |
|
|
data: qs.stringify({...user}) |
|
|
}) |
|
|
}) |
|
|
.then((resp: AxiosResponse) => { |
|
|
.then((resp: AxiosResponse) => { |
|
|
commit("auth_success", user); |
|
|
commit("auth_success", resp.data.user); |
|
|
resolve(resp) |
|
|
resolve(resp) |
|
|
}) |
|
|
}) |
|
|
.catch((err: Error) => { |
|
|
.catch((err: Error) => { |
|
@ -63,6 +63,11 @@ export default createStore({ |
|
|
url: '/auth/current_user' |
|
|
url: '/auth/current_user' |
|
|
}) |
|
|
}) |
|
|
.then((resp: AxiosResponse) => { |
|
|
.then((resp: AxiosResponse) => { |
|
|
|
|
|
if (resp.data === "") { |
|
|
|
|
|
commit('auth_error') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
commit("auth_success", resp.data); |
|
|
commit("auth_success", resp.data); |
|
|
resolve(resp) |
|
|
resolve(resp) |
|
|
}) |
|
|
}) |
|
@ -76,6 +81,7 @@ export default createStore({ |
|
|
modules: {}, |
|
|
modules: {}, |
|
|
getters: { |
|
|
getters: { |
|
|
isLoggedIn: state => state.status, |
|
|
isLoggedIn: state => state.status, |
|
|
|
|
|
user: state => state.user |
|
|
}, |
|
|
}, |
|
|
plugins: [createPersistedState()] |
|
|
plugins: [createPersistedState()] |
|
|
}) |
|
|
}) |
|
|