Selector/Selector.MAUI/Pages/Launch.razor

35 lines
852 B
Plaintext
Raw Normal View History

@page "/"
@using Selector.MAUI.Services;
@inject ILogger<Login> logger;
@inject NavigationManager NavManager;
@inject SessionManager sessionManager;
@inject HubManager hubManager;
@inject StartPageManager startManager;
2023-01-29 21:26:39 +00:00
<img class="spinning centered-spinning" src="/appicon.png" />
@code {
protected async override Task OnInitializedAsync()
{
logger.LogInformation("Starting up");
2023-01-25 22:11:57 +00:00
await sessionManager.LoadUserFromDisk();
if (sessionManager.IsLoggedIn)
{
await hubManager.EnsureConnected();
logger.LogInformation("User logged in, navigating to main app");
startManager.NavigateToStartPage();
}
else
{
logger.LogInformation("User not logged in, navigating to login");
NavManager.NavigateTo("/login");
}
}
}