Minor aesthetic cleanup in SessionModel
This commit is contained in:
@@ -239,6 +239,7 @@ export class SessionModel {
|
|||||||
this.persistSession(account.service, account.did, evt, sess)
|
this.persistSession(account.service, account.did, evt, sess)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await agent.resumeSession({
|
await agent.resumeSession({
|
||||||
accessJwt: account.accessJwt,
|
accessJwt: account.accessJwt,
|
||||||
@@ -261,6 +262,7 @@ export class SessionModel {
|
|||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setActiveSession(agent, account.did)
|
this.setActiveSession(agent, account.did)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@@ -283,14 +285,17 @@ export class SessionModel {
|
|||||||
if (!agent.session) {
|
if (!agent.session) {
|
||||||
throw new Error('Failed to establish session')
|
throw new Error('Failed to establish session')
|
||||||
}
|
}
|
||||||
|
|
||||||
const did = agent.session.did
|
const did = agent.session.did
|
||||||
const addedInfo = await this.loadAccountInfo(agent, did)
|
const addedInfo = await this.loadAccountInfo(agent, did)
|
||||||
|
|
||||||
this.persistSession(service, did, 'create', agent.session, addedInfo)
|
this.persistSession(service, did, 'create', agent.session, addedInfo)
|
||||||
agent.setPersistSessionHandler(
|
agent.setPersistSessionHandler(
|
||||||
(evt: AtpSessionEvent, sess?: AtpSessionData) => {
|
(evt: AtpSessionEvent, sess?: AtpSessionData) => {
|
||||||
this.persistSession(service, did, evt, sess)
|
this.persistSession(service, did, evt, sess)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
this.setActiveSession(agent, did)
|
this.setActiveSession(agent, did)
|
||||||
this.rootStore.log.debug('SessionModel:login succeeded')
|
this.rootStore.log.debug('SessionModel:login succeeded')
|
||||||
}
|
}
|
||||||
@@ -319,14 +324,17 @@ export class SessionModel {
|
|||||||
if (!agent.session) {
|
if (!agent.session) {
|
||||||
throw new Error('Failed to establish session')
|
throw new Error('Failed to establish session')
|
||||||
}
|
}
|
||||||
|
|
||||||
const did = agent.session.did
|
const did = agent.session.did
|
||||||
const addedInfo = await this.loadAccountInfo(agent, did)
|
const addedInfo = await this.loadAccountInfo(agent, did)
|
||||||
|
|
||||||
this.persistSession(service, did, 'create', agent.session, addedInfo)
|
this.persistSession(service, did, 'create', agent.session, addedInfo)
|
||||||
agent.setPersistSessionHandler(
|
agent.setPersistSessionHandler(
|
||||||
(evt: AtpSessionEvent, sess?: AtpSessionData) => {
|
(evt: AtpSessionEvent, sess?: AtpSessionData) => {
|
||||||
this.persistSession(service, did, evt, sess)
|
this.persistSession(service, did, evt, sess)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
this.setActiveSession(agent, did)
|
this.setActiveSession(agent, did)
|
||||||
this.rootStore.onboard.start()
|
this.rootStore.onboard.start()
|
||||||
this.rootStore.log.debug('SessionModel:createAccount succeeded')
|
this.rootStore.log.debug('SessionModel:createAccount succeeded')
|
||||||
|
|||||||
Reference in New Issue
Block a user