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:
@@ -155,7 +155,7 @@ export const SubscriptionPopup = (props) => {
|
||||
} catch (e) {
|
||||
console.log(`[SubscriptionPopup] Error unsubscribing`, e);
|
||||
if (e instanceof UnauthorizedError) {
|
||||
session.resetAndRedirect(routes.login);
|
||||
await session.resetAndRedirect(routes.login);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -298,7 +298,7 @@ const DisplayNameDialog = (props) => {
|
||||
} catch (e) {
|
||||
console.log(`[SubscriptionSettingsDialog] Error updating subscription`, e);
|
||||
if (e instanceof UnauthorizedError) {
|
||||
session.resetAndRedirect(routes.login);
|
||||
await session.resetAndRedirect(routes.login);
|
||||
} else {
|
||||
setError(e.message);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user