@page "/Account/Logout/Confirm"

@using Microsoft.EntityFrameworkCore.Metadata.Internal
@using Microsoft.Extensions.Primitives
@using Microsoft.AspNetCore.Antiforgery;

@attribute [RequireAntiforgeryToken]

@inject NavigationManager Navigation

<div class="w-100 h-100 d-flex flex-column justify-content-center align-items-center">
    <div class="jumbotron">
        <h1>Log out</h1>
        <p class="lead text-left">Are you sure you want to sign out?</p>

        <form action="api/Authorization/connect/logout" method="post">
            <AntiforgeryToken />
            @foreach (var parameter in HttpContext.Request.HasFormContentType ? (IEnumerable<KeyValuePair<string, StringValues>>)HttpContext.Request.Form : HttpContext.Request.Query)
            {
                <input type="hidden" name="@parameter.Key" value="@parameter.Value" />
            }

            <input class="btn btn-lg btn-success" name="submit.Confirm" type="submit" value="Yes" />
        </form>
    </div>
</div>

@code {
    [CascadingParameter]
    private HttpContext HttpContext { get; set; } = default!;
    private  Task OnSubmitLogout()
    {
        
        Navigation.NavigateTo("/Account/Login", forceLoad: true);
        return Task.CompletedTask;
    }
}
