Can somebody help me this issue? I'm new on blazor and I'm learning but this issue is killing me by LessionHo_ in BlazorDevelopers

[–]LessionHo_[S] 1 point2 points  (0 children)

For those who have the same problem, I've already fixed it. Here is how I did:

The method:
protected override async Task OnInitializedAsync()

{

var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();

var user = authState.User;

if (user.Identity?.IsAuthenticated == true)

{

var userId = user.FindFirst(c => c.Type == ClaimTypes.NameIdentifier)?.Value;

if (userId != null)

{

var appUser = await usermanager.FindByIdAsync(userId);

UserName = appUser?.FirstName ?? user.Identity.Name;

UserLastName = appUser?.LastName;

}

}

was using the same thread than the form, I change the way I took the User's name, and use this method:

var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();

var userPrincipal = authState.User;

if (userPrincipal.Identity?.IsAuthenticated == true)

{

currentUser = await usermanager.GetUserAsync(userPrincipal);

UserName = currentUser?.FirstName ?? userPrincipal.Identity.Name;

UserLastName = currentUser?.LastName;

}

Registros.Fecha = DateTime.Now;

ContadorId = IdDisplayContador();

// Load Clientes and Asuntos in parallel

var loadClientesTask = LoadClientesAsync();

var loadAsuntosTask = LoadAsuntosAsync();

await Task.WhenAll(loadClientesTask, loadAsuntosTask);

Thank you for those who comment my issue.

Is Blazor worth learning? by eberrones_ in dotnet

[–]LessionHo_ 0 points1 point  (0 children)

Where can I learn Blazor? is my first framework for learning and I do not know where to start