Skip to content

Commit a0626bf

Browse files
authored
Update Program.cs (#130)
1 parent 2e64333 commit a0626bf

File tree

1 file changed

+10
-4
lines changed
  • 8.0/BlazorWebAssemblyStandaloneWithIdentity/Backend

1 file changed

+10
-4
lines changed

8.0/BlazorWebAssemblyStandaloneWithIdentity/Backend/Program.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,17 @@
4242
app.MapIdentityApi<AppUser>();
4343

4444
// provide an end point to clear the cookie for logout
45-
app.MapPost("/Logout", async (ClaimsPrincipal user, SignInManager<AppUser> signInManager) =>
45+
app.MapPost("/logout", async (
46+
SignInManager<MyUser> signInManager,
47+
[FromBody]object empty) =>
4648
{
47-
await signInManager.SignOutAsync();
48-
return TypedResults.Ok();
49-
});
49+
if (empty is not null)
50+
{
51+
await signInManager.SignOutAsync();
52+
return Results.Ok();
53+
}
54+
return Results.NotFound();
55+
}).RequireAuthorization();
5056

5157
// activate the CORS policy
5258
app.UseCors("wasm");

0 commit comments

Comments
 (0)