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) => { return new Promise(async (resolve, reject) => {
if (store.state.oauth.userToken) { if (store.state.oauth.userToken) {
try { try {
await store.dispatch('loginUser', store.state.oauth.userToken) await store.dispatch('loginUser', store.getters.getUserToken())
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} }

View file

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