This commit is contained in:
Henry Jameson 2019-06-13 10:00:06 +03:00
parent d551b39859
commit dba8d8910c
2 changed files with 6 additions and 1 deletions

View file

@ -248,7 +248,7 @@ const checkOAuthToken = async ({ store }) => {
return new Promise(async (resolve, reject) => {
if (store.state.oauth.userToken) {
try {
await store.dispatch('loginUser', store.state.oauth.userToken)
await store.dispatch('loginUser', store.getters.getUserToken())
} catch (e) {
console.log(e)
}

View file

@ -29,6 +29,11 @@ const oauth = {
// state.token is userToken with older name, coming from persistent state
// added here for smoother transition, otherwise user will be logged out
return state.userToken || state.token || state.appToken
},
getUserToken: state => () => {
// state.token is userToken with older name, coming from persistent state
// added here for smoother transition, otherwise user will be logged out
return state.userToken || state.token
}
}
}