Skip to content

Commit

Permalink
Adds resetSession function
Browse files Browse the repository at this point in the history
  • Loading branch information
leoMehlig committed Apr 27, 2024
1 parent c686635 commit d937d14
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Sources/Auth/AuthClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,13 @@ public final class AuthClient: @unchecked Sendable {
return session
}


/// Resets the session without sending a singout request to the server.
func resetSession() async {
await sessionManager.remove()
eventEmitter.emit(.signedOut, session: nil)
}

/// Signs out the current user, if there is a logged in user.
///
/// If using ``SignOutScope/others`` scope, no ``AuthChangeEvent/signedOut`` event is fired.
Expand Down Expand Up @@ -883,8 +890,7 @@ public final class AuthClient: @unchecked Sendable {
}

if scope != .others {
await sessionManager.remove()
eventEmitter.emit(.signedOut, session: nil)
await self.resetSession()
}
}

Expand Down

0 comments on commit d937d14

Please sign in to comment.