From d937d14ba9ab33c03811b36ef9b4ec76cb4e6f20 Mon Sep 17 00:00:00 2001 From: leoMehlig Date: Sat, 27 Apr 2024 13:28:06 +0200 Subject: [PATCH] Adds `resetSession` function --- 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 a3bcb49a..ebc9d24a 100644 --- a/Sources/Auth/AuthClient.swift +++ b/Sources/Auth/AuthClient.swift @@ -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. @@ -883,8 +890,7 @@ public final class AuthClient: @unchecked Sendable { } if scope != .others { - await sessionManager.remove() - eventEmitter.emit(.signedOut, session: nil) + await self.resetSession() } }