@page "/"
@using salesbook.Shared.Core.Interface
@attribute [Authorize]
@inject IFormFactor FormFactor
@inject INetworkService NetworkService

@code
{
    protected override Task OnInitializedAsync()
    {
        var lastSyncDate = LocalStorage.Get<DateTime>("last-sync");

        if (!FormFactor.IsWeb() && NetworkService.IsNetworkAvailable() && lastSyncDate.Equals(DateTime.MinValue))
        {
            NavigationManager.NavigateTo("/sync");
            return base.OnInitializedAsync();
        }

        NavigationManager.NavigateTo("/Calendar");
        return base.OnInitializedAsync();
    }
}
