@page "/account" @using HyperCube.Models; @using Microsoft.AspNetCore.Identity; @inject AuthenticationStateProvider AuthenticationStateProvider @inject UserManager UserManager; @attribute [Authorize]

Личный кабинет

UUID: @account.UUID
Name: @account.Name
Email: @account.Email
ETH Address: @account.eth_address
Balance: @myBalance WEI
@code { private AccountModel account = new(); string myBalance = ""; protected override async Task OnInitializedAsync() { account = await GetCurrentAcc(); if (Blockchain.GetMain() != null) myBalance = await account.GetBalance(); } private async Task GetCurrentAcc() { AccountModel account = new(); var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); var user = authState.User; if (user.Identity.IsAuthenticated) { var currentUser = await UserManager.GetUserAsync(user); var acc = AccountModel.Find(currentUser.Id); if (acc != null) account = acc; account.AccRole = Role.User; return account; } return null; } }