35 lines
879 B
Plaintext
35 lines
879 B
Plaintext
@using Oqtane.Themes
|
|
@using Oqtane.Services
|
|
@using Oqtane.Providers
|
|
@inherits ThemeObjectBase
|
|
@inject IUriHelper UriHelper
|
|
@inject IUserService UserService
|
|
@inject ServerAuthenticationStateProvider AuthStateProvider
|
|
|
|
<AuthorizeView>
|
|
<Authorizing>
|
|
<text>...</text>
|
|
</Authorizing>
|
|
<Authorized>
|
|
<button type="button" class="btn btn-primary" @onclick="@LogoutUser">Logout</button>
|
|
</Authorized>
|
|
<NotAuthorized>
|
|
<button type="button" class="btn btn-primary" @onclick="@LoginUser">Login</button>
|
|
</NotAuthorized>
|
|
</AuthorizeView>
|
|
|
|
|
|
@code {
|
|
private void LoginUser()
|
|
{
|
|
UriHelper.NavigateTo(NavigateUrl("login"));
|
|
}
|
|
|
|
private async Task LogoutUser()
|
|
{
|
|
await UserService.LogoutUserAsync();
|
|
AuthStateProvider.NotifyAuthenticationChanged();
|
|
UriHelper.NavigateTo(NavigateUrl(""));
|
|
}
|
|
}
|