1. 로그인 동작을 위해서 viewmodel 로 관련 뷰에서 동작할 모든 로직을 viewmodel에서 관리 1.1. view 와 viewmodel의 관계는 1:N으로 동작하는것을 기반으로 두고 있음 2. API 접근하는 방식도 웹만의 접근 방법에서 수정 3. 로그인 동작 정보 받는 로직 수정
22 lines
543 B
C#
22 lines
543 B
C#
using Front.Program.ViewModels;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace Front.Program.Views.Academy;
|
|
|
|
public partial class TopNavAcademy : ComponentBase
|
|
{
|
|
[Inject] UserViewModel UserViewModel { get; set; } = default!;
|
|
|
|
|
|
protected bool isOpen = false;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
Console.WriteLine("TOPNAV_OnInitializedAsync");
|
|
|
|
if (string.IsNullOrEmpty(UserViewModel.UserData.Name))
|
|
{
|
|
await UserViewModel.GetUserDataAsync();
|
|
}
|
|
}
|
|
} |