From 66ad5543f1fb74c8e75edba7d626cdeeb8297d44 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 1 May 2024 01:36:56 +0100 Subject: [PATCH] [Session] Move deactivated field off the session object (#3780) --- src/state/session/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/state/session/index.tsx b/src/state/session/index.tsx index 2eb389bd..6cdfa145 100644 --- a/src/state/session/index.tsx +++ b/src/state/session/index.tsx @@ -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) { @@ -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`)