Skip to content

Commit

Permalink
Refactor login forms
Browse files Browse the repository at this point in the history
  • Loading branch information
oveldman committed Mar 23, 2024
1 parent 0edef71 commit 7f2b16f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
13 changes: 10 additions & 3 deletions sources/Clients.Admin/Components/Pages/Authentications/Login.razor
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@

protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
if (!firstRender)
{
await AuthenticationManager.LoginFromSessionAsync();
StateHasChanged();
return;
}

var result = await AuthenticationManager.LoginFromSessionAsync();
if (result.IsSuccess)
{
NavigationManager.NavigateTo("/AuthenticationTest");
}

StateHasChanged();
}

private async Task TryLogin()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@

protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
if (!firstRender)
{
await AuthenticationManager.LogoutAsync();
StateHasChanged();
return;
}

await AuthenticationManager.LogoutAsync();
StateHasChanged();
}

}

0 comments on commit 7f2b16f

Please sign in to comment.