@inject NavigationManager NavigationManager

@code {
    /// <inheritdoc />
    protected override void OnInitialized()
    {
        var returnUrl = NavigationManager.Uri;
        if (string.IsNullOrWhiteSpace(returnUrl) || returnUrl == "/")
        {
            NavigationManager.NavigateTo($"user/login", forceLoad: true);
        }
        else
        {
            NavigationManager.NavigateTo($"user/login?returnUrl={Uri.EscapeDataString(NavigationManager.Uri)}", forceLoad: true);
        }
    }
}
