bulletboards/ImageBoardServerApp/Pages/Moderation/ModMenu.razor
2023-02-07 21:21:38 +01:00

31 lines
No EOL
870 B
Text

@page "/modmenu"
@using ImageBoardServerApp.Auth
@inject AuthenticationStateProvider authStateProvider
@inject NavigationManager navManager
<h3>ModMenu</h3>
<AuthorizeView>
<Authorized>
<span>Welcome @mail to the mod menu</span>
<div>
<a href="/modmenu/reports">[Reports]</a>
</div>
</Authorized>
<NotAuthorized>
<a href="/login">You do not have permission to view this menu.</a>
</NotAuthorized>
</AuthorizeView>
@code {
private string mail { get; set; } = "";
protected override async Task OnInitializedAsync()
{
var cauthStateProvder = (CustomAuthenticationStateProvider)authStateProvider;
var user = await cauthStateProvder.GetAuthenticationStateAsync();
if (user.User.Identity.IsAuthenticated)
{
mail = user.User.Identity.Name;
}
}
}