forked from AcaMate/AcaMate_Web
[✨] URI 파라미터 로직 수정 및 로거 기능 추가 중
This commit is contained in:
parent
c04152dac8
commit
def25d2206
30
Program.cs
30
Program.cs
|
@ -6,8 +6,25 @@ using Front;
|
|||
using Front.Program.Services;
|
||||
using Front.Program.ViewModels;
|
||||
|
||||
const bool local = true;
|
||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
|
||||
|
||||
Func<bool, Uri> checkLocal = (isLocal) =>
|
||||
{
|
||||
if (isLocal) return new Uri("http://0.0.0.0:5144");
|
||||
else return builder.HostEnvironment.IsDevelopment() ? new Uri("https://devacamate.ipstein.myds.me") : new Uri("https://acamate.ipstein.myds.me");
|
||||
};
|
||||
|
||||
|
||||
if (local)
|
||||
{
|
||||
builder.Logging.SetMinimumLevel(LogLevel.Debug);
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Logging.SetMinimumLevel(builder.HostEnvironment.IsDevelopment() ? LogLevel.Debug: LogLevel.Warning);
|
||||
}
|
||||
|
||||
builder.RootComponents.Add<App>("#app");
|
||||
builder.RootComponents.Add<HeadOutlet>("head::after");
|
||||
|
||||
|
@ -15,19 +32,16 @@ builder.RootComponents.Add<HeadOutlet>("head::after");
|
|||
// builder.Configuration.AddJsonFile("appsettings.json", optional: false);
|
||||
builder.Configuration.AddJsonFile($"appsettings.{builder.HostEnvironment.Environment}.json", optional: true);
|
||||
|
||||
|
||||
|
||||
builder.Services.AddScoped(sp => //new HttpClient
|
||||
{
|
||||
|
||||
|
||||
var config = builder.Configuration;
|
||||
var http = new HttpClient
|
||||
{
|
||||
// BaseAddress = new Uri("http://0.0.0.0:5144")
|
||||
BaseAddress = new Uri("https://devacamate.ipstein.myds.me")
|
||||
// BaseAddress = builder.HostEnvironment.IsDevelopment()
|
||||
// ? new Uri("https://devacamate.ipstein.myds.me")
|
||||
// : new Uri("https://acamate.ipstein.myds.me")
|
||||
|
||||
// 서버 올릴때는 이 부분을 꼭 확인 할 것
|
||||
// true 면 로컬 / false 면 배포
|
||||
BaseAddress = checkLocal(local)
|
||||
};
|
||||
return http;
|
||||
});
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
<div class="max-h-[180px] overflow-y-auto rounded-xl bg-second-normal/10 border-2 border-text-detail">
|
||||
@foreach (var academy in UserStateService.academyItems)
|
||||
{
|
||||
<a href="/am/main?@academy.bid"
|
||||
<a href="/am/main?bid=@academy.bid"
|
||||
class="block w-full px-4 py-3 hover:bg-second-dark border-b border-gray-200 last:border-b-0 group">
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="text-text-black group-hover:text-text-white font-medium">@academy.name</span>
|
||||
|
|
|
@ -48,22 +48,6 @@ public partial class AcademyIntro : ComponentBase, IDisposable
|
|||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
// 유저 값 가져오면서 같이 academy 정보도 가져와야지
|
||||
|
||||
|
||||
|
||||
// academyItems = new[]
|
||||
// {
|
||||
// new SimpleAcademy{ bid = "AA0000", business_name = "테스트 학원1"},
|
||||
// new SimpleAcademy{ bid = "AA0001", business_name = "테스트 학원2"},
|
||||
// new SimpleAcademy{ bid = "AA0002", business_name = "테스트 학원3"},
|
||||
// new SimpleAcademy{ bid = "AA0003", business_name = "테스트 학원4"},
|
||||
// new SimpleAcademy{ bid = "AA0004", business_name = "테스트 학원5"},
|
||||
// new SimpleAcademy{ bid = "AA0005", business_name = "테스트 학원6"},
|
||||
// new SimpleAcademy{ bid = "AA0006", business_name = "테스트 학원7"},
|
||||
|
||||
// };
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
@ -121,10 +105,6 @@ public partial class AcademyIntro : ComponentBase, IDisposable
|
|||
LoadingService.HideLoading();
|
||||
_isProcessing = false;
|
||||
|
||||
// var baseUri = uri.GetLeftPart(UriPartial.Path);
|
||||
// Console.WriteLine($"리다이렉트할 URI: {baseUri}");
|
||||
// await InvokeAsync(StateHasChanged); // StateHasChanged를 호출하여 UI 업데이트
|
||||
// Navigation.NavigateTo(baseUri, forceLoad: false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,48 @@
|
|||
using Front.Program.Services;
|
||||
using Front.Program.ViewModels;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace Front.Program.Views.Academy;
|
||||
|
||||
public partial class AcademyMain : ComponentBase
|
||||
{
|
||||
[Inject] private ILogger<AcademyMain> Logger { get; set; } = default!;
|
||||
[Inject] NavigationManager Navigation { get; set; } = default!;
|
||||
[Inject] UserStateService UserStateService { get; set; } = default!;
|
||||
[Inject] QueryParamService QueryParamService { get; set; } = default!;
|
||||
[Inject] StorageService StorageService { get; set; } = default!;
|
||||
[Inject] LoadingService LoadingService { get; set; } = default!;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// 초기화 작업
|
||||
// await UserStateService.GetUserDataAsync();
|
||||
// if (UserStateService.isFirstCheck)
|
||||
// {
|
||||
// // 첫 번째 체크 후에만 Academy 정보를 가져옴
|
||||
// var academyResult = await UserStateService.GetAcademy();
|
||||
//
|
||||
// if (academyResult.success && academyResult.simpleAcademy.Count > 0)
|
||||
// {
|
||||
// UserStateService.academyItems = academyResult.simpleAcademy.ToArray();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// URL 파라미터 처리
|
||||
|
||||
var uri = Navigation.ToAbsoluteUri(Navigation.Uri);
|
||||
Logger.LogDebug("DEBUG");
|
||||
Logger.LogError("ERROR");
|
||||
|
||||
|
||||
Console.WriteLine("쿼리 있나?");
|
||||
// 쿼리 파라미터가 있는 경우에만 처리
|
||||
if (!string.IsNullOrEmpty(uri.Query))
|
||||
{
|
||||
var queryParam = QueryParamService.ParseQueryParam(uri);
|
||||
Console.WriteLine($"Parsed Query Parameters: {string.Join(", ", queryParam.Select(kv => $"{kv.Key}={kv.Value}"))}");
|
||||
}
|
||||
Console.WriteLine("쿼리 검사");
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user