forked from AcaMate/AcaMate_Web
1. Console에 바로 나오던 메세지들 개발 환경에 따라 나오게 필터링 하는 서비스 개발 2. script 쪽에도 추가 하여 js 에서도 필터링 되게 구현
42 lines
1.3 KiB
C#
42 lines
1.3 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
|
|
|
namespace Front.Program.Services;
|
|
|
|
public class QueryParamService
|
|
{
|
|
public Dictionary<string, string> ParseQueryParam(System.Uri uri)
|
|
{
|
|
var result = new Dictionary<string, string>();
|
|
if (!string.IsNullOrEmpty(uri.Query))
|
|
{
|
|
var query = uri.Query.TrimStart('?');
|
|
var parameters = query.Split('&')
|
|
.Select(p => p.Split('='))
|
|
.Where(p => p.Length == 2)
|
|
.ToDictionary(p => p[0], p => p[1]);
|
|
result = parameters;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
public async Task AuthCheck(Dictionary<string, string> parameters, StorageService storageService)
|
|
{
|
|
if (parameters.TryGetValue("auth", out var auth))
|
|
{
|
|
LoggerService.Write($"auth 파라미터 값: {auth}");
|
|
if (auth == "true")
|
|
{
|
|
await storageService.SetItemAsync("IsLogin", "true");
|
|
LoggerService.Write("로그인 상태를 true로 설정했습니다.");
|
|
}
|
|
else
|
|
{
|
|
await storageService.RemoveItemAsync("IsLogin");
|
|
LoggerService.Write("로그인 상태를 제거했습니다.");
|
|
|
|
}
|
|
}
|
|
}
|
|
} |