Skip to content

Commit

Permalink
[Session] Move deactivated field off the session object (#3780)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon authored May 1, 2024
1 parent 339f265 commit 66ad554
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/state/session/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,13 +422,14 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
logger.error(`session: could not decode jwt`)
}

const accountOrSessionDeactivated =
isSessionDeactivated(account.accessJwt) || account.deactivated

const prevSession = {
accessJwt: account.accessJwt || '',
refreshJwt: account.refreshJwt || '',
did: account.did,
handle: account.handle,
deactivated:
isSessionDeactivated(account.accessJwt) || account.deactivated,
}

if (canReusePrevSession) {
Expand All @@ -440,7 +441,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
await fetchingGates
upsertAccount(account)

if (prevSession.deactivated) {
if (accountOrSessionDeactivated) {
// don't attempt to resume
// use will be taken to the deactivated screen
logger.debug(`session: reusing session for deactivated account`)
Expand Down

0 comments on commit 66ad554

Please sign in to comment.