Fix session replica behaviour (merge with session)
The harder-to-refactor parts are the places where exists/username/token are called within a React component. However, `resetAndRedirect` and `store` are already called from async contexts, so adding an `await` is simple. This thus merges the logic, keeping localStorage for the components to call, but making sure reset/store behaviour works correctly for the replica.
This commit is contained in:
parent
4e44b034bd
commit
8ccfa5c3fb
15 changed files with 43 additions and 78 deletions
|
@ -114,7 +114,7 @@ export const useAutoSubscribe = (subscriptions, selected) => {
|
|||
} catch (e) {
|
||||
console.log(`[Hooks] Auto-subscribing failed`, e);
|
||||
if (e instanceof UnauthorizedError) {
|
||||
session.resetAndRedirect(routes.login);
|
||||
await session.resetAndRedirect(routes.login);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue