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 af9d0ba commit 2f40089
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 @@ -703,6 +703,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 @@ -732,8 +739,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 2f40089

Please sign in to comment.