Skip to content

Commit

Permalink
Adds resetSession funtion
Browse files Browse the repository at this point in the history
  • Loading branch information
leoMehlig committed May 9, 2024
1 parent e5c564a commit e9473d1
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 @@ -693,6 +693,13 @@ public final class AuthClient: Sendable {
return session
}


/// Resets the session without sending a singout request to the server.
public 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 @@ -722,8 +729,7 @@ public final class AuthClient: Sendable {
}

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

Expand Down

0 comments on commit e9473d1

Please sign in to comment.