Selector/Selector.MAUI/Pages/Launch.razor
2023-01-25 22:11:57 +00:00

30 lines
685 B
Plaintext

@page "/"
@using Selector.MAUI.Services;
@inject ILogger<Login> logger;
@inject NavigationManager NavManager;
@inject SessionManager sessionManager;
<h1>Loading...</h1>
@code {
protected async override Task OnInitializedAsync()
{
logger.LogInformation("Starting up");
await sessionManager.LoadUserFromDisk();
if (sessionManager.IsLoggedIn)
{
logger.LogInformation("User logged in, navigating to main app");
NavManager.NavigateTo("/app");
}
else
{
logger.LogInformation("User not logged in, navigating to login");
NavManager.NavigateTo("/login");
}
}
}