Fix for auth logout test case.
This commit is contained in:
parent
d6b0b7610a
commit
8fb5168d56
|
@ -225,7 +225,12 @@ export async function platformLogout(opts: PlatformLogoutOpts) {
|
|||
|
||||
const sessionIds = sessions.map(({ sessionId }) => sessionId)
|
||||
await invalidateSessions(userId, { sessionIds, reason: "logout" })
|
||||
const user = await userCache.getUser(userId)
|
||||
await events.auth.logout(user.email)
|
||||
let user: User | undefined
|
||||
try {
|
||||
user = await userCache.getUser(userId)
|
||||
} catch {
|
||||
user = undefined
|
||||
}
|
||||
await events.auth.logout(user?.email)
|
||||
await userCache.invalidateUser(userId)
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ async function login(source: LoginSource, email: string) {
|
|||
await publishEvent(Event.AUTH_LOGIN, properties)
|
||||
}
|
||||
|
||||
async function logout(email: string) {
|
||||
async function logout(email?: string) {
|
||||
const identity = await identification.getCurrentIdentity()
|
||||
const properties: LogoutEvent = {
|
||||
userId: identity.id,
|
||||
|
|
|
@ -15,7 +15,7 @@ export interface LoginEvent extends BaseEvent {
|
|||
export interface LogoutEvent extends BaseEvent {
|
||||
userId: string
|
||||
audited: {
|
||||
email: string
|
||||
email?: string
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue