oqtane.framework/Oqtane.Client/Themes/Controls/Profile.razor

35 lines
839 B
Plaintext

@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Web
@using Oqtane.Themes
@namespace Oqtane.Themes.Controls
@inherits ThemeControlBase
@inject NavigationManager NavigationManager
<AuthorizeView>
<Authorizing>
<text>...</text>
</Authorizing>
<Authorized>
<button type="button" class="btn btn-primary" @onclick="UpdateProfile">@context.User.Identity.Name</button>
</Authorized>
<NotAuthorized>
<button type="button" class="btn btn-primary" @onclick="RegisterUser">Register</button>
</NotAuthorized>
</AuthorizeView>
@code {
private void RegisterUser()
{
NavigationManager.NavigateTo(NavigateUrl("register"));
}
private void UpdateProfile()
{
NavigationManager.NavigateTo(NavigateUrl("profile"));
}
}