diff --git a/ChessCubing.App/Components/SiteMenu.razor b/ChessCubing.App/Components/SiteMenu.razor
index af58f55..ec02073 100644
--- a/ChessCubing.App/Components/SiteMenu.razor
+++ b/ChessCubing.App/Components/SiteMenu.razor
@@ -42,7 +42,7 @@
@DisplayName
@DisplayMeta
-
+ Se deconnecter
}
else
@@ -89,7 +89,7 @@
@DisplayName
@DisplayMeta
-
+ Se deconnecter
}
else
@@ -395,29 +395,6 @@
}
}
- private async Task LogoutAsync()
- {
- if (IsSubmitting)
- {
- return;
- }
-
- IsSubmitting = true;
- FormError = null;
- CloseMobileMenu();
-
- try
- {
- await Http.PostAsync("api/auth/logout", null);
- AuthenticationStateProvider.SetAnonymous();
- await RefreshAuthenticationStateAsync();
- }
- finally
- {
- IsSubmitting = false;
- }
- }
-
private void HandleAuthenticationStateChanged(Task authenticationStateTask)
=> _ = InvokeAsync(RefreshAuthenticationStateAsync);
diff --git a/ChessCubing.Server/Program.cs b/ChessCubing.Server/Program.cs
index 27ee2eb..aa3a8de 100644
--- a/ChessCubing.Server/Program.cs
+++ b/ChessCubing.Server/Program.cs
@@ -291,6 +291,12 @@ app.MapPost("/api/auth/logout", async Task (HttpContext httpContext) =>
return TypedResults.Ok(AuthSessionResponse.FromUser(new ClaimsPrincipal(new ClaimsIdentity())));
});
+app.MapGet("/api/auth/logout/browser", async Task (HttpContext httpContext) =>
+{
+ await httpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
+ return TypedResults.Redirect("/index.html");
+});
+
app.Run();
static AdminUserSummaryResponse MapAdminSummary(AdminIdentityUser identity, UserProfileResponse? profile)