1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2025-08-20 08:24:02 +02:00

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:
nimbleghost 2023-06-13 14:00:51 +02:00
parent 4e44b034bd
commit 8ccfa5c3fb
15 changed files with 43 additions and 78 deletions
web/src/components

View file

@ -140,7 +140,7 @@ const UpgradeDialog = (props) => {
} catch (e) {
console.log(`[UpgradeDialog] Error changing billing subscription`, e);
if (e instanceof UnauthorizedError) {
session.resetAndRedirect(routes.login);
await session.resetAndRedirect(routes.login);
} else {
setError(e.message);
}