Creating dotnet Blazor Server app that uses MS Identity services. When user registers and logins, the app sends them a razor component that adds additional user info not kept in MS Identity - they must complete this to continue. I'm using Identity auth & roles in both navbar and index page redirects. When I run this in the user form (razor component)...
navMgr.NavigateTo("/", forceLoad: true);
It doesn't even leave the razor component which is embedded in Index.razor.
What I would like is that this form completion would completely refresh to "/" for that user (as if they just logged in). Do I have to log the user out to do this?
This seems to fix the problem in the index.razor page. Used consumer and disabled in my @if().
protected override async Task OnParametersSetAsync()
{
authstate = await GetAuthenticationStateAsync.GetAuthenticationStateAsync();
authuser = authstate.User.Identity.Name;
if (authuser != null)
{
user = await userManager.FindByEmailAsync(authuser);
consumer = await userManager.IsInRoleAsync(user, "Consumer");
disabled = await userManager.IsInRoleAsync(user, "Disabled");
}
}