From e9473d113b2c858b9b18b3bb804cf6a49b5d0f9f Mon Sep 17 00:00:00 2001 From: leoMehlig Date: Thu, 9 May 2024 13:19:13 +0200 Subject: [PATCH] Adds `resetSession` funtion --- Sources/Auth/AuthClient.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/Auth/AuthClient.swift b/Sources/Auth/AuthClient.swift index f7f67efb..8dafe49b 100644 --- a/Sources/Auth/AuthClient.swift +++ b/Sources/Auth/AuthClient.swift @@ -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. @@ -722,8 +729,7 @@ public final class AuthClient: Sendable { } if scope != .others { - await sessionManager.remove() - eventEmitter.emit(.signedOut, session: nil) + await self.resetSession() } }