using IdentityServer.DDD.Contracts.Models; using Microsoft.AspNetCore.Components; namespace IdentityServer.Pages.Authentication; public partial class Logout { [Parameter] [SupplyParameterFromQuery] public string LogoutId { get; set; } public LogOutModel LogOutModel { get; set; } protected override void OnInitialized() { LogOutModel ??= new LogOutModel(); LogOutModel.Prompt = true; } protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { LogOutModel = await Spa.GetLogOutAsync(LogoutId); if (LogOutModel.Prompt) { StateHasChanged(); } else { await HandleSubmit(); } } } private async Task HandleSubmit() { LogOutModel = await Spa.PostLogOutAsync(LogoutId); } [Inject] SpaService Spa { get; set; } }