initial upload
This commit is contained in:
parent
a0aa9cc28e
commit
f857f43df4
553 changed files with 46169 additions and 13 deletions
40
src/Web/Insight.Web/Pages/Account/Profile.razor.cs
Normal file
40
src/Web/Insight.Web/Pages/Account/Profile.razor.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
using Insight.Infrastructure.Entities;
|
||||
using Insight.Infrastructure.Services;
|
||||
using Insight.Web.Constants;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using MudBlazor;
|
||||
|
||||
namespace Insight.Web.Pages.Account;
|
||||
|
||||
[Route(Navigation.Account.Profile)]
|
||||
public partial class Profile
|
||||
{
|
||||
[Parameter] public InsightUser? Account { get; set; }
|
||||
|
||||
[Inject] private IdentityService IdentityService { get; init; } = default!;
|
||||
[Inject] private AuthenticationStateProvider AuthenticationStateProvider { get; init; } = default!;
|
||||
|
||||
private readonly string _title = "Profile|Insight";
|
||||
private readonly List<BreadcrumbItem> _breadcrumbs = new()
|
||||
{
|
||||
new BreadcrumbItem("Home", href: Navigation.Home),
|
||||
new BreadcrumbItem("Account", href: Navigation.Account.Profile),
|
||||
new BreadcrumbItem("Profile", href: "#", true)
|
||||
};
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await OnRefreshAsync();
|
||||
}
|
||||
|
||||
private async Task OnRefreshAsync()
|
||||
{
|
||||
var state = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
if (state?.User?.Identity?.Name is null) return;
|
||||
|
||||
Account = await IdentityService.GetByEmailAsync(state.User.Identity.Name).ConfigureAwait(false);
|
||||
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue