From ef246bae32117cc74dc92e1ce94d96c6fbe470f6 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 15 Jun 2026 16:59:16 +0200 Subject: [PATCH] Add LogoutSenderAsync method to AuthService A new asynchronous method `LogoutSenderAsync` was added to the `AuthService` class to handle sender user logout. The method sends a POST request to the `/api/auth/logout` endpoint and removes the authentication cookie. It accepts an optional `CancellationToken` parameter and returns a `bool` indicating the success of the operation. XML documentation comments were included to describe the method's functionality. --- EnvelopeGenerator.ReceiverUI/Services/AuthService.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/EnvelopeGenerator.ReceiverUI/Services/AuthService.cs b/EnvelopeGenerator.ReceiverUI/Services/AuthService.cs index c0b020dd..4fa759ee 100644 --- a/EnvelopeGenerator.ReceiverUI/Services/AuthService.cs +++ b/EnvelopeGenerator.ReceiverUI/Services/AuthService.cs @@ -78,4 +78,16 @@ public class AuthService(HttpClient http, IOptions apiOptions) _ => SenderLoginResult.Error }; } + + /// + /// Logs out the sender user by removing the authentication cookie. + /// Calls POST /api/auth/logout. + /// + public async Task LogoutSenderAsync(CancellationToken cancel = default) + { + var response = await http.PostAsync( + $"{_api.BaseUrl}/api/auth/logout", + null, cancel); + return response.IsSuccessStatusCode; + } }