diff --git a/apps/sn/app/(with-base-layout)/ii/result/page.tsx b/apps/sn/app/(with-base-layout)/ii/result/page.tsx index e8dc11c11..b285cc5e1 100644 --- a/apps/sn/app/(with-base-layout)/ii/result/page.tsx +++ b/apps/sn/app/(with-base-layout)/ii/result/page.tsx @@ -1,5 +1,5 @@ 'use client' -import { deleteData, getData } from '@/components/lib/api' +import { deleteData, getData, useCookieAuth } from '@/components/lib/api' import { UiTable, downloadExcel, downloadExcelWithKoreanHeaders } from '@common/business_components/ui' import { zodResolver } from '@hookform/resolvers/zod' import { useState, useEffect } from 'react' @@ -86,7 +86,7 @@ const Result = () => { // setCurPage(1); handleSearchButtonClick(); }, []) - + const auth = useCookieAuth(); const handleSearchButtonClick = async (customFormValues?: Partial) => { setIsLoadingResult(true); setResetSelection(true); @@ -113,6 +113,7 @@ const Result = () => { "sggCd": formValues.sggCd, "swageTmplntCd": processedSwageTmplntCd, // "swtrmtZoneCd": formValues.swtrmtZoneCd, + "auth" : auth, }; } else { inftwtAnlsSearchDto = { @@ -123,6 +124,7 @@ const Result = () => { "sggCd": formValues.sggCd?.val === '0' ? null : formValues.sggCd?.val, "swageTmplntCd": processedSwageTmplntCd, // "swtrmtZoneCd": formValues.swtrmtZoneCd === '0' ? null : formValues.swtrmtZoneCd, + "auth" : auth, }; } console.log("Search DTO:", inftwtAnlsSearchDto); diff --git a/apps/sn/app/components/lib/api/index.ts b/apps/sn/app/components/lib/api/index.ts index 55d111074..22a4b276a 100644 --- a/apps/sn/app/components/lib/api/index.ts +++ b/apps/sn/app/components/lib/api/index.ts @@ -1,4 +1,5 @@ -const BASE_URL = 'http://con.mind-one.co.kr:11083/sewerage-service/api'; +import {useState, useEffect} from 'react'; +const BASE_URL = process.env.NEXT_PUBLIC_SEWERAGE_API_URL || ""; export const postData = async (url: string, data: object): Promise => { const options: RequestInit = { @@ -79,4 +80,29 @@ export const deleteData = async (url: string, data?: object): Promise => { const res = await fetch(url.startsWith('/') ? `${url}` : `${BASE_URL}/${url}`, options); if (res.status === 204) return true return res; +}; + +export function getCookie(name:string) { + const match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)')); + if (match && match[2]) { + return decodeURIComponent(match[2]); + } + return null; +} + +export const useCookieAuth = () => { + const [data, setData] = useState(""); + + useEffect(() => { + const fetch = async () => { + const result = getCookie("Authorization"); + if (result) { + setData(result); + } + }; + fetch(); + console.log("useCookieAuth 호출"); + }, []); + + return data; }; \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cfd9bc5bc..8f3d4a4ea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -323,6 +323,9 @@ importers: '@common/components': specifier: workspace:* version: link:../../packages/common/components + '@fontsource-variable/noto-sans-kr': + specifier: ^5.2.5 + version: 5.2.5 '@frontend-opensource/use-react-hooks': specifier: ^1.1.4 version: 1.1.4 @@ -341,6 +344,9 @@ importers: '@tanstack/react-query': specifier: ^5.67.1 version: 5.67.1(react@18.3.1) + '@tanstack/react-query-devtools': + specifier: ^5.75.5 + version: 5.75.5(@tanstack/react-query@5.67.1)(react@18.3.1) '@tanstack/react-table': specifier: ^8.21.2 version: 8.21.2(react-dom@18.3.1)(react@18.3.1) @@ -362,15 +368,6 @@ importers: next: specifier: 15.1.7 version: 15.1.7(react-dom@18.3.1)(react@18.3.1) - ol: - specifier: ^7.3.0 - version: 7.5.2 - ol-ext: - specifier: ^4.0.11 - version: 4.0.31(ol@7.5.2) - proj4: - specifier: ^2.9.0 - version: 2.15.0 react-chartjs-2: specifier: ^5.3.0 version: 5.3.0(chart.js@4.4.8)(react@18.3.1) @@ -532,6 +529,9 @@ importers: '@hookform/resolvers': specifier: ^4.1.3 version: 4.1.3(react-hook-form@7.54.2) + '@minoru/react-dnd-treeview': + specifier: 3.5.1-alpha.1 + version: 3.5.1-alpha.1(dnd-core@16.0.1)(react-dnd@16.0.1)(react-dom@18.3.1)(react@18.3.1) '@radix-ui/react-label': specifier: ^2.1.2 version: 2.1.2(@types/react-dom@18.3.5)(@types/react@18.3.18)(react-dom@18.3.1)(react@18.3.1) @@ -562,12 +562,24 @@ importers: lucide-react: specifier: ^0.474.0 version: 0.474.0(react@18.3.1) + ol: + specifier: ^7.3.0 + version: 7.5.2 + ol-ext: + specifier: ^4.0.11 + version: 4.0.31(ol@7.5.2) path: specifier: ^0.12.7 version: 0.12.7 + proj4: + specifier: ^2.9.0 + version: 2.15.0 react-day-picker: specifier: ^8.10.1 version: 8.10.1(date-fns@3.6.0)(react@18.3.1) + react-dnd: + specifier: ^16.0.1 + version: 16.0.1(@types/node@22.13.9)(@types/react@18.3.18)(react@18.3.1) react-dropzone: specifier: ^14.3.8 version: 14.3.8(react@18.3.1) @@ -2544,7 +2556,7 @@ packages: dnd-multi-backend: 8.1.2(dnd-core@16.0.1) framer-motion: 11.18.2(react-dom@18.3.1)(react@18.3.1) react: 18.3.1 - react-dnd: 16.0.1(@types/node@22.13.5)(@types/react@18.3.18)(react@18.3.1) + react-dnd: 16.0.1(@types/node@22.13.9)(@types/react@18.3.18)(react@18.3.1) react-dnd-html5-backend: 16.0.1 react-dnd-touch-backend: 16.0.1 react-dom: 18.3.1(react@18.3.1)