feat: added proper reloading of sidebar when updating boards

Signed-off-by: limited_dev <loginakkisativ@gmail.com>
This commit is contained in:
limited_dev 2023-06-08 23:31:39 +02:00
parent 56e144e8ab
commit 24d70c6bcd

View file

@ -1,5 +1,4 @@
@using ImageBoardServerApp.Auth @using ImageBoardServerApp.Data.Repository
@using ImageBoardServerApp.Data.Repository
@inject AuthenticationStateProvider authStateProvider @inject AuthenticationStateProvider authStateProvider
@inject NavigationManager navManager @inject NavigationManager navManager
@ -45,7 +44,7 @@
</NavLink> </NavLink>
</div> </div>
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="/" @onclick="logout" Match="NavLinkMatch.All"> <NavLink class="nav-link" href="/sys/logout" Match="NavLinkMatch.All">
<span class="oi oi-account-logout" aria-hidden="true"></span> Logout <span class="oi oi-account-logout" aria-hidden="true"></span> Logout
</NavLink> </NavLink>
</div> </div>
@ -76,18 +75,12 @@
{ {
collapseNavMenu = !collapseNavMenu; collapseNavMenu = !collapseNavMenu;
} }
private async Task logout()
{
var customAuthStateProvider = (CustomAuthenticationStateProvider) authStateProvider;
await customAuthStateProvider.UpdateAuthenticationStateAsync(null);
navManager.NavigateTo("/", true);
}
public List<BoardData> boards { get; set; } public List<BoardData> boards { get; set; }
protected override async Task OnInitializedAsync() protected override async Task OnParametersSetAsync()
{ {
await base.OnParametersSetAsync();
boards = await BoardsRepository.getBoardsAsync(); boards = await BoardsRepository.getBoardsAsync();
} }