You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.1 KiB
Plaintext
69 lines
2.1 KiB
Plaintext
@inherits LayoutComponentBase
|
|
|
|
@using KWWebInvApp.Data
|
|
@using KWWebInvApp.Services;
|
|
|
|
@inject IAuthenticationService AuthenticationStateService
|
|
@inject AuthenticationStateProvider AuthenticationStateProvider
|
|
@inject NavigationManager navigationManager
|
|
|
|
<MudThemeProvider />
|
|
<MudDialogProvider />
|
|
<MudSnackbarProvider />
|
|
|
|
<MudLayout>
|
|
|
|
<AuthorizeView>
|
|
<Authorized>
|
|
<MudAppBar Elevation="0">
|
|
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => DrawerToggle())" />
|
|
<MudSpacer />
|
|
<MudIconButton Icon="@Icons.Custom.Brands.MudBlazor" Color="Color.Inherit" Link="https://mudblazor.com/" Target="_blank" />
|
|
<MudIconButton Icon="@Icons.Custom.Brands.GitHub" Color="Color.Inherit" Link="https://github.com/MudBlazor/MudBlazor/" Target="_blank" />
|
|
<MudIconButton Icon="@Icons.Material.Filled.Logout" Color="Color.Inherit" OnClick="Logout" />
|
|
</MudAppBar>
|
|
</Authorized>
|
|
</AuthorizeView>
|
|
|
|
|
|
<AuthorizeView>
|
|
<Authorized>
|
|
<MudDrawer @bind-Open="_drawerOpen" Elevation="1">
|
|
<MudDrawerHeader>
|
|
<MudText Typo="Typo.h6">KW Web Inventory</MudText>
|
|
</MudDrawerHeader>
|
|
<NavMenu />
|
|
</MudDrawer>
|
|
</Authorized>
|
|
</AuthorizeView>
|
|
|
|
<MudMainContent>
|
|
<MudContainer MaxWidth="MaxWidth.Large" Class="my-16 pt-16">
|
|
@Body
|
|
</MudContainer>
|
|
</MudMainContent>
|
|
</MudLayout>
|
|
|
|
@code {
|
|
bool _drawerOpen = true;
|
|
private UserInfoServices.userinfo? user;
|
|
|
|
protected override async void OnAfterRender(bool firstRender)
|
|
{
|
|
base.OnAfterRender(firstRender);
|
|
|
|
user = await AuthenticationStateService.GetAuthenticatedUserAsync();
|
|
}
|
|
|
|
void DrawerToggle()
|
|
{
|
|
_drawerOpen = !_drawerOpen;
|
|
}
|
|
|
|
async void Logout()
|
|
{
|
|
var webAuthenticationStateProvider = (WebAuthenticationStateProvider)AuthenticationStateProvider;
|
|
await webAuthenticationStateProvider.LogoutAsync();
|
|
navigationManager.NavigateTo("/");
|
|
}
|
|
} |