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

32 lines
No EOL
919 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>
<a href="/modmenu/users">[Users]</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;
}
}
}