You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
942 B

using Identity.Api.DDD.Contracts.Models;
using Microsoft.AspNetCore.Components;
namespace Identity.Api.Pages;
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; }
}