fo: header에 site-id추가

This commit is contained in:
2026-04-15 15:59:22 +09:00
parent 0e81ed1c07
commit 5f954c0a9d
3 changed files with 18 additions and 4 deletions
+8 -2
View File
@@ -1,4 +1,5 @@
import { DEV_URL_FO, DEV_URL_WR, LOCAL_URL } from "./config/env";
import { SITE_ID } from "@/src/shared/config/env";
import { DEV_URL_FO, DEV_URL_WR, LOCAL_URL } from "./config/env";
export const getFetch = async (part : string, url: string) => {
let reqUrl = "";
@@ -7,6 +8,7 @@ export const getFetch = async (part : string, url: string) => {
method: "GET",
headers: {
accept: "application/json",
"X-Site-Id": SITE_ID,
}
});
if(!response.ok) {
@@ -21,6 +23,7 @@ export const getFetchAreaList = async (url: string) => {
method: "GET",
headers: {
accept: "application/json",
"X-Site-Id": SITE_ID,
}
});
if(!response.ok) {
@@ -37,6 +40,7 @@ export const postFetch = async (part : string, url: string, params: unknown) =>
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Site-Id": SITE_ID,
},
body: JSON.stringify(params),
});
@@ -53,6 +57,7 @@ export const putFetch = async (part : string, url: string, params: unknown) => {
method: "PUT",
headers: {
"Content-Type": "application/json",
"X-Site-Id": SITE_ID,
},
body: JSON.stringify(params),
});
@@ -69,6 +74,7 @@ export const deleteFetch = async (part : string, url: string, params: unknown) =
method: "DELETE",
headers: {
"Content-Type": "application/json",
"X-Site-Id": SITE_ID,
},
body: JSON.stringify(params),
});
@@ -76,4 +82,4 @@ export const deleteFetch = async (part : string, url: string, params: unknown) =
throw new Error(`오류 발생: ${response.status}`);
}
return response;
}
}
+5 -1
View File
@@ -1,5 +1,6 @@
"use client";
import { SITE_ID } from "@/src/shared/config/env";
import Gis from "@common/business_components/ui/map/Gis";
import GisApp from "@common/business_components/ui/map/lib/gis.core";
import { useEffect, useRef, useState } from "react";
@@ -59,7 +60,10 @@ const Map = () => {
const reqUrl = `${API_URL}/lyrStngs/FO_NETWORK`;
const response = await fetch(reqUrl, {
method: "GET",
headers: { accept: "application/json" },
headers: {
accept: "application/json",
"X-Site-Id": SITE_ID,
},
});
if (!response.ok) throw new Error(`HTTP 오류! 상태: ${response.status}`);
const data = await response.json();
@@ -1,4 +1,5 @@
"use client";
import { SITE_ID } from "@/src/shared/config/env";
import React from "react";
export default function TestPage() {
@@ -6,6 +7,9 @@ export default function TestPage() {
const handleFindUser = () => {
fetch('/operation-service/api/v1/fclt/flow/1/10/2024', {
method: "GET",
headers: {
"X-Site-Id": SITE_ID,
},
}).then((data) => {
console.log(data);
});
@@ -19,4 +23,4 @@ export default function TestPage() {
</button>
</div>
);
}
}