[Session] Move deactivated field off the session object (#3780)

zio/stable
dan 2024-05-01 01:36:56 +01:00 committed by GitHub
parent 339f26567a
commit 66ad5543f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -422,13 +422,14 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
logger.error(`session: could not decode jwt`) logger.error(`session: could not decode jwt`)
} }
const accountOrSessionDeactivated =
isSessionDeactivated(account.accessJwt) || account.deactivated
const prevSession = { const prevSession = {
accessJwt: account.accessJwt || '', accessJwt: account.accessJwt || '',
refreshJwt: account.refreshJwt || '', refreshJwt: account.refreshJwt || '',
did: account.did, did: account.did,
handle: account.handle, handle: account.handle,
deactivated:
isSessionDeactivated(account.accessJwt) || account.deactivated,
} }
if (canReusePrevSession) { if (canReusePrevSession) {
@ -440,7 +441,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
await fetchingGates await fetchingGates
upsertAccount(account) upsertAccount(account)
if (prevSession.deactivated) { if (accountOrSessionDeactivated) {
// don't attempt to resume // don't attempt to resume
// use will be taken to the deactivated screen // use will be taken to the deactivated screen
logger.debug(`session: reusing session for deactivated account`) logger.debug(`session: reusing session for deactivated account`)