Skip to content

Commit

Permalink
Update Sources/Auth/AuthClient.swift
Browse files Browse the repository at this point in the history
Co-authored-by: Guilherme Souza <[email protected]>
  • Loading branch information
leoMehlig and grdsdev authored May 10, 2024
1 parent c869307 commit 99a7780
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Sources/Auth/AuthClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -698,17 +698,16 @@ public final class AuthClient: Sendable {
/// If using ``SignOutScope/others`` scope, no ``AuthChangeEvent/signedOut`` event is fired.
/// - Parameter scope: Specifies which sessions should be logged out.
public func signOut(scope: SignOutScope = .global) async throws {
let accessToken = currentSession?.accessToken
guard let accessToken = currentSession?.accessToken else {
configuration.logger?.warning("signOut called without a session")
return
}

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

guard let accessToken else {
throw AuthError.sessionNotFound
}

do {
_ = try await api.execute(
.init(
Expand Down

0 comments on commit 99a7780

Please sign in to comment.