wr: header에 site_id추가

This commit is contained in:
2026-04-14 17:39:12 +09:00
parent 0e57bbc4e8
commit 812293b4fa
9 changed files with 48 additions and 16 deletions
+3
View File
@@ -2,6 +2,8 @@
/**
* 관망도 API
*/
import { SITE_ID } from "@/src/shared/config";
const API_URL = `/sewerage-service/api/v1/map`
//const API_URL = "http://con.mind-one.co.kr:11083/sewerage-service/api/v1/map";
@@ -35,6 +37,7 @@ export const mapService = {
method: 'GET',
headers: {
'Accept': 'application/json',
'X-Site-Id': SITE_ID,
},
});
@@ -3,6 +3,7 @@
* 관망도 API
*/
import { DEV_URL_WR, DEV_URL_SN } from "@/components/lib/config";
import { SITE_ID } from "@/src/shared/config";
export type LyrStngProps = {
lyr_sn: string
@@ -34,6 +35,7 @@ export const mapService = {
method: 'GET',
headers: {
'Accept': 'application/json',
'X-Site-Id': SITE_ID,
},
});
@@ -48,6 +50,7 @@ export const mapService = {
method: 'GET',
headers: {
'Accept': 'application/json',
'X-Site-Id': SITE_ID,
},
});
@@ -645,7 +645,7 @@ export default function PbnstPrfmncSttn() {
selectArray={yearOptions}
value={toDate}
onSelectValue={(val: string | number) => setToDate(String(val))} />
<Label className="w-28 mt-2 text-xl">
<Label className="w-28 text-xl">
{"시설명"}
</Label>
<SearchInput
+2
View File
@@ -1,6 +1,7 @@
import { getFetch } from "@/components/lib/api";
import type { FacilityInfo, SubsInfo } from "./type";
import { DEV_URL_FO } from "@/components/lib/config";
import { SITE_ID } from "@/src/shared/config";
const checkWrRegList = async () => {
const wrRegList = await getFetch("wr", `/reuseFc/pubFc`);
@@ -26,6 +27,7 @@ const getRuseFclt = async (
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Site-Id": SITE_ID,
},
body: JSON.stringify(ruseList),
});
@@ -6,6 +6,7 @@ import {
postFectch,
putFectch,
} from "@/components/lib/api";
import { SITE_ID } from "@/src/shared/config";
import type { chHeadType } from "@/app/store/prfmncReg/chkgdnReg/rainChkgdn/headList";
import {
type customPbnst,
@@ -307,6 +308,7 @@ export const pubFacActionsExport: (set: any) => pubFacActions = (set: any) => {
method: "GET",
headers: {
accept: "application/octet-stream",
"X-Site-Id": SITE_ID,
},
}
);
+16 -11
View File
@@ -1,5 +1,5 @@
import { DEV_URL_FO, DEV_URL_WR, LOCAL_URL } from "../config/";
import { CLAIM_NAME } from "@/src/shared/config";
import { CLAIM_NAME, SITE_ID } from "@/src/shared/config";
import { tokenManager } from "@/src/entities/auth/lib/token-manager";
export const fetchType = {
@@ -12,6 +12,11 @@ export const fetchType = {
const LOGIN_PAGE_URL =
process.env.NEXT_PUBLIC_CM_LOGIN_PAGE_URL || "/auth/login";
const getDefaultHeaders = (headers: HeadersInit = {}) => ({
...headers,
"X-Site-Id": SITE_ID,
});
const handleUnauthorizedResponse = () => {
if (typeof window === "undefined") return;
@@ -43,9 +48,9 @@ export const getFetch = async (type: string, url: string) => {
const apiUrl = div + url;
const response = await fetch(apiUrl, {
method: "GET",
headers: {
headers: getDefaultHeaders({
accept: "application/json",
},
}),
});
if (response.status === 401) {
@@ -95,9 +100,9 @@ export const getFetchWithCount = async (type: string, url: string) => {
const response = await fetch(apiUrl, {
method: "GET",
headers: {
headers: getDefaultHeaders({
accept: "application/json",
},
}),
});
if (response.status === 401) {
@@ -140,10 +145,10 @@ export const postFectch = async (url: string, params: any, type?: string) => {
const apiUrl = div + url;
const response = await fetch(apiUrl, {
method: "POST",
headers: {
headers: getDefaultHeaders({
accept: "application/json",
"Content-Type": "application/json",
},
}),
body: JSON.stringify(params),
});
if (response.status === 401) {
@@ -168,9 +173,9 @@ export const putFectch = async (url: string, params: any, type?: string) => {
const response = await fetch(apiUrl, {
method: "PUT",
headers: {
headers: getDefaultHeaders({
"Content-Type": "application/json",
},
}),
body: JSON.stringify(params),
});
if (response.status === 401) {
@@ -199,9 +204,9 @@ export const deleteFectch = async (
const response = await fetch(apiUrl, {
method: "DELETE",
headers: {
headers: getDefaultHeaders({
"Content-Type": "application/json",
},
}),
body: params ? JSON.stringify(params) : undefined,
});
if (response.status === 401) {
+10 -1
View File
@@ -20,6 +20,10 @@ export class LoginApiService implements LoginService {
tokenManager.clearAuthToken();
const response = await fetch( PROXY_HOST+ ENDPOINT.USER_SERVICE.LOGIN, {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-Site-Id": SITE_ID,
},
body: JSON.stringify({
userId: payload.userId,
password: payload.password,
@@ -52,7 +56,12 @@ export class LoginApiService implements LoginService {
try {
const response = await fetch(PROXY_HOST+
`${ENDPOINT.USER_SERVICE.SILENT_REFRESH}`,
{ method: "PUT" },
{
method: "PUT",
headers: {
"X-Site-Id": SITE_ID,
},
},
);
const data = await response.json();
@@ -1,5 +1,5 @@
import { useState } from "react";
import { ACCESS_TOKEN, AUTH_USER_ID, REFRESH_TOKEN, CLAIM_NAME } from "@/src/shared/config";
import { ACCESS_TOKEN, AUTH_USER_ID, REFRESH_TOKEN, CLAIM_NAME, SITE_ID } from "@/src/shared/config";
import { tokenManager } from "@/src/entities/auth/lib/token-manager";
import {
Button,
@@ -35,7 +35,10 @@ export default function OtpModal({ onClose, onSuccess, open, onOpenChange }: Otp
// Proxy를 통해 OTP 인증 처리
const response = await fetch(`/api/proxy/user-service/api/v1/auth/2fa/verify`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: {
'Content-Type': 'application/json',
'X-Site-Id': SITE_ID,
},
body: JSON.stringify({
otpCode: otp,
tempToken
@@ -5,6 +5,7 @@ import {
Dialog,
DialogContent,
} from "@common/components";
import { SITE_ID } from "@/src/shared/config";
interface TwoFAModalProps {
onClose: () => void;
@@ -36,7 +37,10 @@ export default function TwoFAModal({ onClose, onSuccess, open, onOpenChange }: T
// Proxy를 통해 2FA setup 처리
const response = await fetch(`/api/proxy/user-service/api/v1/auth/2fa/setup`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
headers: {
'Content-Type': 'application/json',
'X-Site-Id': SITE_ID,
},
body: JSON.stringify({ tempToken }),
});
@@ -90,6 +94,7 @@ export default function TwoFAModal({ onClose, onSuccess, open, onOpenChange }: T
headers: {
'Content-Type': 'application/json',
'Authorization': tempToken,
'X-Site-Id': SITE_ID,
},
body: JSON.stringify({
otpCode: otp,