@page "/logout"
@attribute [Authorize]

@inject NavigationManager Navigation
@inject HttpClient Http

<PageTitle>로그아웃 중...</PageTitle>

<div style="display: flex; justify-content: center; align-items: center; min-height: 100vh;">
    <div style="text-align: center;">
        <p>로그아웃 중입니다...</p>
    </div>
</div>

@code {
    protected override async Task OnInitializedAsync()
    {
        try
        {
            await Http.PostAsync("/api/portal/logout", null);
        }
        catch
        {
            // 로그아웃 실패해도 무조건 로그인 페이지로
        }
        finally
        {
            Navigation.NavigateTo("/login", forceLoad: true);
        }
    }
}
