2023-01-22 22:15:55 +00:00
|
|
|
@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");
|
|
|
|
|
2023-01-25 22:11:57 +00:00
|
|
|
await sessionManager.LoadUserFromDisk();
|
2023-01-22 22:15:55 +00:00
|
|
|
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|