list of authorities, changing authority auth data
This commit is contained in:
		| @@ -1,12 +1,41 @@ | ||||
| @inherits LayoutComponentBase | ||||
| @using BlazorWebAssemblyVisaApiClient.Components.Auth | ||||
| @using BlazorWebAssemblyVisaApiClient.Infrastructure.Services.UserDataProvider | ||||
| @inherits LayoutComponentBase | ||||
| <div class="page"> | ||||
|     <div class="sidebar"> | ||||
|         <NavMenu/> | ||||
|     </div> | ||||
|  | ||||
|     <main> | ||||
|         <article class="content px-4 fullscreen"> | ||||
|     <main class="fullscreen"> | ||||
|         <div class="top-row px-4"> | ||||
|             <AuthComponent @ref="authComponent"/> | ||||
|             @if (UserDataProvider.CurrentRole is not null) | ||||
|             { | ||||
|                 <p> | ||||
|                     Logged as @UserDataProvider.CurrentRole (@AuthComponent.AuthData?.Email) | ||||
|                     <button class="btn-secondary" @onclick="authComponent.Logout">Log out</button> | ||||
|                 </p> | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 <NavLink href="/">Log in</NavLink> | ||||
|             } | ||||
|         </div> | ||||
|  | ||||
|         <article class="content px-4"> | ||||
|             @Body | ||||
|         </article> | ||||
|     </main> | ||||
| </div> | ||||
|  | ||||
| @code | ||||
| { | ||||
|     private AuthComponent authComponent = null!; | ||||
|  | ||||
|     [Inject] private IUserDataProvider UserDataProvider { get; set; } = null!; | ||||
|  | ||||
|     protected override void OnInitialized() | ||||
|     { | ||||
|         UserDataProvider.OnRoleChanged += StateHasChanged; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -26,7 +26,7 @@ | ||||
|             </div> | ||||
|         </nav> | ||||
|     } | ||||
|     @if(UserDataProvider.CurrentRole is Constants.ApplicantRole) | ||||
|     @if (UserDataProvider.CurrentRole is Constants.ApplicantRole) | ||||
|     { | ||||
|     <nav class="flex-column"> | ||||
|         <div class="nav-item px-3"> | ||||
| @@ -36,6 +36,16 @@ | ||||
|         </div> | ||||
|     </nav> | ||||
|     } | ||||
|     @if (UserDataProvider.CurrentRole is Constants.AdminRole) | ||||
|     { | ||||
|         <nav class="flex-column"> | ||||
|             <div class="nav-item px-3"> | ||||
|                 <NavLink class="nav-link" href="authorities" Match="NavLinkMatch.All"> | ||||
|                     <span class="bi bi-list-nested-nav-menu" aria-hidden="true"></span> Authorities | ||||
|                 </NavLink> | ||||
|             </div> | ||||
|         </nav> | ||||
|     } | ||||
| </div> | ||||
|  | ||||
| @code { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user