15 lines
394 B
Text
15 lines
394 B
Text
|
|
@inject NavigationManager Navigation
|
||
|
|
@inject AuthenticationStateProvider AuthStateProvider
|
||
|
|
|
||
|
|
@rendermode InteractiveServer
|
||
|
|
|
||
|
|
@code {
|
||
|
|
protected override async Task OnInitializedAsync()
|
||
|
|
{
|
||
|
|
var state = await AuthStateProvider.GetAuthenticationStateAsync();
|
||
|
|
if (state.User.Identity?.IsAuthenticated == true)
|
||
|
|
return;
|
||
|
|
Navigation.NavigateTo("/login");
|
||
|
|
}
|
||
|
|
}
|