@if (authState.User.Identity?.IsAuthenticated == true) { } else { } @code { [CascadingParameter] private Task? AuthenticationState { get; set; } private Type _currentLayout = typeof(Layout.CmsHomeLayout); protected override async Task OnParametersSetAsync() { if (AuthenticationState is not null) { var authState = await AuthenticationState; _currentLayout = authState.User.Identity?.IsAuthenticated == true ? typeof(Layout.CmsLayout) : typeof(Layout.CmsHomeLayout); } } }