refactor: config 패키지 추가

This commit is contained in:
2025-04-30 15:23:26 +09:00
parent c52c602daf
commit 9da7aff85a
44 changed files with 504 additions and 112 deletions
+13 -5
View File
@@ -1,7 +1,15 @@
import { Client } from "@common/network";
import { BASE_URL, SITE_ID } from "../config";
import { getConfig } from "@common/config";
export const client = Client.getInstance({
baseURL: BASE_URL,
siteId: SITE_ID,
});
const getClientInstance = () => {
const config = getConfig();
const { PROXY_HOST, SITE_ID } = config;
const BASE_URL = `${PROXY_HOST}/server`;
return Client.getInstance({
baseURL: BASE_URL,
siteId: SITE_ID ?? "",
});
};
export const getApiClient = () => getClientInstance();
+3 -1
View File
@@ -1,4 +1,4 @@
import { client } from "./client";
import { getApiClient } from "./client";
import { ENDPOINT } from "../config";
export interface MenuItem {
@@ -21,6 +21,8 @@ export interface MenuItem {
requiredUrlPath: boolean;
}
const client = getApiClient();
export const getMenuList = async (siteId: string) => {
const response = await client.get<MenuItem[]>(
`${ENDPOINT.CMS_SERVICE.MENU_ROLES}/${siteId}`,
+3 -1
View File
@@ -1,4 +1,4 @@
import { client } from "./client";
import { getApiClient } from "./client";
import { ENDPOINT } from "../config";
export interface SiteInfo {
@@ -23,6 +23,8 @@ export interface SiteInfo {
mdfrNm: string;
}
const client = getApiClient();
export const getSiteInfo = async (siteId: string) => {
const response = await client.get<SiteInfo>(
`${ENDPOINT.CMS_SERVICE.SITES}/${siteId}`,
+3 -1
View File
@@ -1,4 +1,4 @@
import { client } from "./client";
import { getApiClient } from "./client";
import { ENDPOINT } from "../config";
export interface IUser {
@@ -35,6 +35,8 @@ export interface IUser {
hasPassword: boolean;
}
const client = getApiClient();
export const getUserInfo = async (userUniqId: string) => {
const response = await client.get<IUser>(
`${ENDPOINT.USER_SERVICE.USERS}/${userUniqId}`,