forked from AcaMate/AcaMate_Web
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
|
|
using Front.Program.Models;
|
|
using Front.Program.Services;
|
|
|
|
namespace Front;
|
|
|
|
public partial class App : ComponentBase
|
|
{
|
|
[Inject] private APIService API { get; set; } = default!;
|
|
[Inject] private StorageService StorageService { get; set; } = default!;
|
|
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
if (firstRender)
|
|
{
|
|
var headerValue = await StorageService.GetItemAsync("Web-AM-Connect-Key");
|
|
|
|
// 값 없으면 API 호출
|
|
if (string.IsNullOrEmpty(headerValue))
|
|
{
|
|
var response = await API.GetJsonAsync<APIHeader, AppHeader>(
|
|
"/api/v1/in/app",
|
|
new AppHeader()
|
|
{
|
|
type = "W",
|
|
specific = "Web_Connect",
|
|
project = "AcaMate"
|
|
});
|
|
if (!string.IsNullOrEmpty(response.data.header))
|
|
{
|
|
await StorageService.SetItemAsync("Web-AM-Connect-Key", response.data.header);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |