bulletboards/ImageBoardServerApp/Pages/Accounts/Logout.razor

20 lines
636 B
Text
Raw Normal View History

@page "/sys/logout"
@using ImageBoardServerApp.Auth
@inject NavigationManager navManager
@inject AuthenticationStateProvider authStateProvider
<h3>Logging out...</h3>
@code {
protected override async Task OnParametersSetAsync()
{
await base.OnParametersSetAsync();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
await base.OnAfterRenderAsync(firstRender);
var customAuthStateProvider = (CustomAuthenticationStateProvider) authStateProvider;
await customAuthStateProvider.UpdateAuthenticationStateAsync(null);
navManager.NavigateTo("/", true);
}
}