forked from AkkomaGang/akkoma-fe
fix
This commit is contained in:
parent
d551b39859
commit
dba8d8910c
2 changed files with 6 additions and 1 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue