Skip to content

Commit

Permalink
[Session] Consistently copy SessionAgent fields (#3779)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Bailey <[email protected]>
  • Loading branch information
gaearon and estrattonbailey authored May 1, 2024
1 parent 80bcf81 commit 339f265
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/state/session/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function createPersistSessionHandler(
handle: session?.handle || account.handle,
email: session?.email || account.email,
emailConfirmed: session?.emailConfirmed || account.emailConfirmed,
emailAuthFactor: session?.emailAuthFactor || account.emailAuthFactor,
deactivated: isSessionDeactivated(session?.accessJwt),
pdsUrl: agent.pdsUrl?.toString(),

Expand Down Expand Up @@ -271,8 +272,9 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
service: agent.service.toString(),
did: agent.session.did,
handle: agent.session.handle,
email: agent.session.email!, // TODO this is always defined?
emailConfirmed: false,
email: agent.session.email,
emailConfirmed: agent.session.emailConfirmed,
emailAuthFactor: agent.session.emailAuthFactor,
refreshJwt: agent.session.refreshJwt,
accessJwt: agent.session.accessJwt,
deactivated,
Expand Down Expand Up @@ -324,7 +326,7 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
did: agent.session.did,
handle: agent.session.handle,
email: agent.session.email,
emailConfirmed: agent.session.emailConfirmed || false,
emailConfirmed: agent.session.emailConfirmed,
emailAuthFactor: agent.session.emailAuthFactor,
refreshJwt: agent.session.refreshJwt,
accessJwt: agent.session.accessJwt,
Expand Down Expand Up @@ -506,8 +508,8 @@ export function Provider({children}: React.PropsWithChildren<{}>) {
did: agent.session.did,
handle: agent.session.handle,
email: agent.session.email,
emailConfirmed: agent.session.emailConfirmed || false,
emailAuthFactor: agent.session.emailAuthFactor || false,
emailConfirmed: agent.session.emailConfirmed,
emailAuthFactor: agent.session.emailAuthFactor,
refreshJwt: agent.session.refreshJwt,
accessJwt: agent.session.accessJwt,
deactivated: isSessionDeactivated(agent.session.accessJwt),
Expand Down

0 comments on commit 339f265

Please sign in to comment.