2023-01-22 22:15:55 +00:00
|
|
|
@page "/"
|
|
|
|
@using Selector.MAUI.Services;
|
|
|
|
@inject ILogger<Login> logger;
|
|
|
|
@inject NavigationManager NavManager;
|
|
|
|
@inject SessionManager sessionManager;
|
2023-01-28 14:41:03 +00:00
|
|
|
@inject HubManager hubManager;
|
|
|
|
@inject StartPageManager startManager;
|
2023-01-22 22:15:55 +00:00
|
|
|
|
2023-01-29 21:26:39 +00:00
|
|
|
<img class="spinning centered-spinning" src="/appicon.png" />
|
2023-01-22 22:15:55 +00:00
|
|
|
|
|
|
|
@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)
|
|
|
|
{
|
2023-01-28 14:41:03 +00:00
|
|
|
await hubManager.EnsureConnected();
|
|
|
|
|
2023-01-22 22:15:55 +00:00
|
|
|
logger.LogInformation("User logged in, navigating to main app");
|
2023-01-28 14:41:03 +00:00
|
|
|
|
|
|
|
startManager.NavigateToStartPage();
|
2023-01-22 22:15:55 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
logger.LogInformation("User not logged in, navigating to login");
|
|
|
|
NavManager.NavigateTo("/login");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|