fix email not updating in session state after email change
This commit is contained in:
committed by
Samuel Newman
parent
9746dd8e4c
commit
9ec3f4b6a3
@@ -58,7 +58,10 @@ export type Action =
|
||||
| {
|
||||
type: 'partial-refresh-session'
|
||||
accountDid: string
|
||||
patch: Pick<SessionAccount, 'emailConfirmed' | 'emailAuthFactor'>
|
||||
patch: Pick<
|
||||
SessionAccount,
|
||||
'email' | 'emailConfirmed' | 'emailAuthFactor'
|
||||
>
|
||||
}
|
||||
|
||||
function createPublicAgentState(): AgentState {
|
||||
@@ -239,6 +242,7 @@ let reducer = (state: State, action: Action): State => {
|
||||
* Only mutating values that are safe. Be very careful with this.
|
||||
*/
|
||||
if (agent.session) {
|
||||
agent.session.email = patch.email ?? agent.session.email
|
||||
agent.session.emailConfirmed =
|
||||
patch.emailConfirmed ?? agent.session.emailConfirmed
|
||||
agent.session.emailAuthFactor =
|
||||
@@ -255,6 +259,7 @@ let reducer = (state: State, action: Action): State => {
|
||||
if (a.did === accountDid) {
|
||||
return {
|
||||
...a,
|
||||
email: patch.email ?? a.email,
|
||||
emailConfirmed: patch.emailConfirmed ?? a.emailConfirmed,
|
||||
emailAuthFactor: patch.emailAuthFactor ?? a.emailAuthFactor,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user