bulletboards/ImageBoardServerApp/Shared/MainLayout.razor

35 lines
792 B
Text
Raw Normal View History

@using ImageBoardServerApp.Auth
@inherits LayoutComponentBase
@inject AuthenticationStateProvider authStateProvider
@inject NavigationManager navManager
2023-01-18 12:56:24 +00:00
<PageTitle>BulletBoard</PageTitle>
<div class="page">
<div class="sidebar">
<NavMenu/>
</div>
<main>
<article class="content px-4">
@Body
</article>
</main>
</div>
@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 = $"Welcome User # {user.User.Identity.Name}";
}
}
}