Compare commits
No commits in common. "31a63cb643289a7346ba01e134f66ef237434557" and "333f06bb642e0e2aaf4a8136d27e3299c87abfb8" have entirely different histories.
31a63cb643
...
333f06bb64
@ -1,4 +1,3 @@
|
||||
NEXT_PUBLIC_RUN_MODE=development
|
||||
# 모바일 디바이스로 로컬 서버 확인하려면 자신 IP 주소로 변경
|
||||
# 다시 로컬에서 개발할때는 localhost로 변경
|
||||
#route handler
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
NEXT_PUBLIC_RUN_MODE=local
|
||||
# 모바일 디바이스로 로컬 서버 확인하려면 자신 IP 주소로 변경
|
||||
# 다시 로컬에서 개발할때는 localhost로 변경
|
||||
#route handler
|
||||
NEXT_PUBLIC_API_URL=http://localhost:3000
|
||||
|
||||
#qsp 로그인 api
|
||||
NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120
|
||||
|
||||
#1:1문의 api
|
||||
NEXT_PUBLIC_INQUIRY_API_URL=http://1.248.227.176:38080
|
||||
|
||||
#QPARTNER 로그인 api
|
||||
DB_HOST=202.218.61.226
|
||||
DB_USER=readonly
|
||||
DB_PASSWORD=aAjmFW12iHKW84l1
|
||||
DB_DATABASE=qpartners
|
||||
DB_PORT=3306
|
||||
@ -1,6 +1,5 @@
|
||||
NEXT_PUBLIC_RUN_MODE=production
|
||||
#route handler
|
||||
NEXT_PUBLIC_API_URL=http://1.248.227.176:3000
|
||||
NEXT_PUBLIC_API_URL=http://172.30.1.35:3000
|
||||
|
||||
#qsp 로그인 api
|
||||
NEXT_PUBLIC_QSP_API_URL=http://1.248.227.176:8120
|
||||
|
||||
@ -3,15 +3,9 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "env-cmd -f .env.localhost next dev --turbopack",
|
||||
"dev": "next dev --turbopack",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"build:local": "env-cmd -f .env.localhost next build",
|
||||
"build:dev": "env-cmd -f .env.development next build",
|
||||
"build:prod": "env-cmd -f .env.production next build",
|
||||
"start:local": "env-cmd -f .env.localhost next start",
|
||||
"start:dev": "env-cmd -f .env.development next start",
|
||||
"start:prod": "env-cmd -f .env.production next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -19,7 +13,6 @@
|
||||
"@tanstack/react-query": "^5.71.0",
|
||||
"@tanstack/react-query-devtools": "^5.71.0",
|
||||
"axios": "^1.8.4",
|
||||
"env-cmd": "^10.1.0",
|
||||
"iron-session": "^8.0.4",
|
||||
"lucide": "^0.503.0",
|
||||
"mssql": "^11.0.1",
|
||||
|
||||
63
pnpm-lock.yaml
generated
63
pnpm-lock.yaml
generated
@ -20,9 +20,6 @@ importers:
|
||||
axios:
|
||||
specifier: ^1.8.4
|
||||
version: 1.8.4
|
||||
env-cmd:
|
||||
specifier: ^10.1.0
|
||||
version: 10.1.0
|
||||
iron-session:
|
||||
specifier: ^8.0.4
|
||||
version: 8.0.4
|
||||
@ -804,10 +801,6 @@ packages:
|
||||
resolution: {integrity: sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
commander@4.1.1:
|
||||
resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
cookie@0.7.2:
|
||||
resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==}
|
||||
engines: {node: '>= 0.6'}
|
||||
@ -815,10 +808,6 @@ packages:
|
||||
core-js@3.41.0:
|
||||
resolution: {integrity: sha512-SJ4/EHwS36QMJd6h/Rg+GyR4A5xE0FSI3eZ+iBVpfqf1x0eTSg1smWLHrA+2jQThZSh97fmSgFSU8B61nxosxA==}
|
||||
|
||||
cross-spawn@7.0.6:
|
||||
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
css-line-break@2.1.0:
|
||||
resolution: {integrity: sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==}
|
||||
|
||||
@ -877,11 +866,6 @@ packages:
|
||||
resolution: {integrity: sha512-ZSW3ma5GkcQBIpwZTSRAI8N71Uuwgs93IezB7mf7R60tC8ZbJideoDNKjHn2O9KIlx6rkGTTEk1xUCK2E1Y2Yg==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
|
||||
env-cmd@10.1.0:
|
||||
resolution: {integrity: sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA==}
|
||||
engines: {node: '>=8.0.0'}
|
||||
hasBin: true
|
||||
|
||||
es-define-property@1.0.1:
|
||||
resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==}
|
||||
engines: {node: '>= 0.4'}
|
||||
@ -1037,9 +1021,6 @@ packages:
|
||||
resolution: {integrity: sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==}
|
||||
engines: {node: '>=16'}
|
||||
|
||||
isexe@2.0.0:
|
||||
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
|
||||
|
||||
jiti@2.4.2:
|
||||
resolution: {integrity: sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A==}
|
||||
hasBin: true
|
||||
@ -1236,10 +1217,6 @@ packages:
|
||||
resolution: {integrity: sha512-mnkeQ1qP5Ue2wd+aivTD3NHd/lZ96Lu0jgf0pwktLPtx6cTZiH7tyeGRRHs0zX0rbrahXPnXlUnbeXyaBBuIaw==}
|
||||
engines: {node: '>=18'}
|
||||
|
||||
path-key@3.1.1:
|
||||
resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
performance-now@2.1.0:
|
||||
resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==}
|
||||
|
||||
@ -1347,14 +1324,6 @@ packages:
|
||||
resolution: {integrity: sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==}
|
||||
engines: {node: ^18.17.0 || ^20.3.0 || >=21.0.0}
|
||||
|
||||
shebang-command@2.0.0:
|
||||
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
shebang-regex@3.0.0:
|
||||
resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==}
|
||||
engines: {node: '>=8'}
|
||||
|
||||
simple-swizzle@0.2.2:
|
||||
resolution: {integrity: sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==}
|
||||
|
||||
@ -1454,11 +1423,6 @@ packages:
|
||||
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
|
||||
hasBin: true
|
||||
|
||||
which@2.0.2:
|
||||
resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
|
||||
engines: {node: '>= 8'}
|
||||
hasBin: true
|
||||
|
||||
zustand@5.0.3:
|
||||
resolution: {integrity: sha512-14fwWQtU3pH4dE0dOpdMiWjddcH+QzKIgk1cl8epwSE7yag43k/AD/m4L6+K7DytAOr9gGBe3/EXj9g7cdostg==}
|
||||
engines: {node: '>=12.20.0'}
|
||||
@ -2106,19 +2070,11 @@ snapshots:
|
||||
|
||||
commander@11.1.0: {}
|
||||
|
||||
commander@4.1.1: {}
|
||||
|
||||
cookie@0.7.2: {}
|
||||
|
||||
core-js@3.41.0:
|
||||
optional: true
|
||||
|
||||
cross-spawn@7.0.6:
|
||||
dependencies:
|
||||
path-key: 3.1.1
|
||||
shebang-command: 2.0.0
|
||||
which: 2.0.2
|
||||
|
||||
css-line-break@2.1.0:
|
||||
dependencies:
|
||||
utrie: 1.0.2
|
||||
@ -2167,11 +2123,6 @@ snapshots:
|
||||
graceful-fs: 4.2.11
|
||||
tapable: 2.2.1
|
||||
|
||||
env-cmd@10.1.0:
|
||||
dependencies:
|
||||
commander: 4.1.1
|
||||
cross-spawn: 7.0.6
|
||||
|
||||
es-define-property@1.0.1: {}
|
||||
|
||||
es-errors@1.3.0: {}
|
||||
@ -2346,8 +2297,6 @@ snapshots:
|
||||
dependencies:
|
||||
is-inside-container: 1.0.0
|
||||
|
||||
isexe@2.0.0: {}
|
||||
|
||||
jiti@2.4.2: {}
|
||||
|
||||
js-md4@0.3.2: {}
|
||||
@ -2551,8 +2500,6 @@ snapshots:
|
||||
is-inside-container: 1.0.0
|
||||
is-wsl: 3.1.0
|
||||
|
||||
path-key@3.1.1: {}
|
||||
|
||||
performance-now@2.1.0:
|
||||
optional: true
|
||||
|
||||
@ -2675,12 +2622,6 @@ snapshots:
|
||||
'@img/sharp-win32-x64': 0.33.5
|
||||
optional: true
|
||||
|
||||
shebang-command@2.0.0:
|
||||
dependencies:
|
||||
shebang-regex: 3.0.0
|
||||
|
||||
shebang-regex@3.0.0: {}
|
||||
|
||||
simple-swizzle@0.2.2:
|
||||
dependencies:
|
||||
is-arrayish: 0.3.2
|
||||
@ -2762,10 +2703,6 @@ snapshots:
|
||||
|
||||
uuid@8.3.2: {}
|
||||
|
||||
which@2.0.2:
|
||||
dependencies:
|
||||
isexe: 2.0.0
|
||||
|
||||
zustand@5.0.3(@types/react@19.0.12)(react@19.1.0):
|
||||
optionalDependencies:
|
||||
'@types/react': 19.0.12
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
import { NextResponse } from 'next/server'
|
||||
import axios from 'axios'
|
||||
import { CommonCode } from '@/types/Inquiry'
|
||||
|
||||
export async function GET() {
|
||||
const response = await axios.get(`${process.env.NEXT_PUBLIC_INQUIRY_API_URL}/api/system/commonCodeListData`)
|
||||
const codeList: CommonCode[] = []
|
||||
response.data.data.apiCommCdList.forEach((item: any) => {
|
||||
if (item.headCd === '204200' || item.headCd === '204300' || item.headCd === '204400') {
|
||||
codeList.push({
|
||||
headCd: item.headCd,
|
||||
code: item.code,
|
||||
name: item.codeJp,
|
||||
refChar1: item.refChr1,
|
||||
})
|
||||
}
|
||||
})
|
||||
return NextResponse.json({ data: codeList })
|
||||
}
|
||||
@ -113,10 +113,6 @@ export default function page() {
|
||||
<input type="checkbox" id="ch06" disabled />
|
||||
<label htmlFor="ch06">Check Box</label>
|
||||
</div>
|
||||
<div className="check-form-box space">
|
||||
<input type="checkbox" id="ch07" defaultChecked />
|
||||
<label htmlFor="ch07">Check Box</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="design-box">
|
||||
|
||||
@ -5,8 +5,9 @@ import { useEffect, useReducer, useState } from 'react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { useLocalStorage } from 'usehooks-ts'
|
||||
import { useQuery } from '@tanstack/react-query'
|
||||
import { axiosInstance } from '@/libs/axios'
|
||||
import { useSessionStore } from '@/store/session'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
|
||||
interface AccountState {
|
||||
loginId: string
|
||||
pwd: string
|
||||
@ -23,8 +24,6 @@ export default function Login() {
|
||||
//로그인 상태
|
||||
const [isLogin, setIsLogin] = useState(false)
|
||||
|
||||
const { axiosInstance } = useAxios()
|
||||
|
||||
const { session, setSession } = useSessionStore()
|
||||
const [value, setValue, removeValue] = useLocalStorage<{ indivisualData: string }>('hanasysIndivisualState', { indivisualData: '' })
|
||||
|
||||
|
||||
@ -40,8 +40,6 @@ export default function RegistForm() {
|
||||
}
|
||||
}, [session])
|
||||
|
||||
const { commonCodeList } = useInquiry()
|
||||
|
||||
const [attachedFiles, setAttachedFiles] = useState<File[]>([])
|
||||
|
||||
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
@ -115,14 +113,9 @@ export default function RegistForm() {
|
||||
value={inquiryRequest.qnaClsLrgCd}
|
||||
onChange={(e) => setInquiryRequest({ ...inquiryRequest, qnaClsLrgCd: e.target.value })}
|
||||
>
|
||||
<option value="" hidden>選択してください</option>
|
||||
{commonCodeList
|
||||
.filter((code) => code.headCd === '204200')
|
||||
.map((code) => (
|
||||
<option key={code.code} value={code.code}>
|
||||
{code.name}
|
||||
</option>
|
||||
))}
|
||||
<option value="">選択してください</option>
|
||||
<option value="A01">A01</option>
|
||||
<option value="204200">204200</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="data-input mt5">
|
||||
@ -133,14 +126,9 @@ export default function RegistForm() {
|
||||
value={inquiryRequest.qnaClsMidCd}
|
||||
onChange={(e) => setInquiryRequest({ ...inquiryRequest, qnaClsMidCd: e.target.value })}
|
||||
>
|
||||
<option value="" hidden>選択してください</option>
|
||||
{commonCodeList
|
||||
.filter((code) => code.refChar1 === inquiryRequest.qnaClsLrgCd)
|
||||
.map((code) => (
|
||||
<option key={code.code} value={code.code}>
|
||||
{code.name}
|
||||
</option>
|
||||
))}
|
||||
<option value="">選択してください</option>
|
||||
<option value="B02">B02</option>
|
||||
<option value="204300">204300</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="data-input mt5">
|
||||
@ -151,14 +139,9 @@ export default function RegistForm() {
|
||||
value={inquiryRequest.qnaClsSmlCd ?? ''}
|
||||
onChange={(e) => setInquiryRequest({ ...inquiryRequest, qnaClsSmlCd: e.target.value })}
|
||||
>
|
||||
<option value="" hidden>選択してください</option>
|
||||
{commonCodeList
|
||||
.filter((code) => code.refChar1 === inquiryRequest.qnaClsMidCd)
|
||||
.map((code) => (
|
||||
<option key={code.code} value={code.code}>
|
||||
{code.name}
|
||||
</option>
|
||||
))}
|
||||
<option value="">選択してください</option>
|
||||
<option value="C05">C05</option>
|
||||
<option value="204400">204400</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -46,7 +46,9 @@ export default function ListTable() {
|
||||
if (!session.isLoggedIn || !inquiryList) return
|
||||
if (session.isLoggedIn) {
|
||||
setInquiryListRequest({ ...inquiryListRequest, storeId: session.storeId ?? '', loginId: session.userId ?? '' })
|
||||
// setInquiryListRequest({ ...inquiryListRequest, storeId: 'X112', loginId: 'x112' })
|
||||
}
|
||||
console.log('inquiryListRequest', inquiryListRequest)
|
||||
if (inquiryList.length > 0 && inquiryList[0].totCnt > 0) {
|
||||
if (inquiryListRequest.startRow > 1) {
|
||||
const isDuplicate = inquiryList.every((newItem) => heldInquiryList.some((existingItem) => existingItem.qnaNo === newItem.qnaNo))
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
'use client'
|
||||
|
||||
import Link from 'next/link'
|
||||
import Config from '@/config/config.export'
|
||||
|
||||
export default function Footer() {
|
||||
return (
|
||||
@ -12,9 +11,6 @@ export default function Footer() {
|
||||
<span>
|
||||
<Link href="/pdf">PDF</Link>
|
||||
</span>
|
||||
<span>{Config().mode}</span>
|
||||
<span>{Config().baseUrl}</span>
|
||||
<span>{process.env.NEXT_PUBLIC_API_URL}</span>
|
||||
</div>
|
||||
</footer>
|
||||
</>
|
||||
|
||||
@ -13,13 +13,14 @@ import { useSessionStore } from '@/store/session'
|
||||
import { usePopupController } from '@/store/popupController'
|
||||
|
||||
import { useTitle } from '@/hooks/useTitle'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
|
||||
import { axiosInstance } from '@/libs/axios'
|
||||
|
||||
import 'swiper/css'
|
||||
|
||||
export default function Header() {
|
||||
const router = useRouter()
|
||||
const pathname = usePathname()
|
||||
const { axiosInstance } = useAxios()
|
||||
const [value, setValue, removeValue] = useLocalStorage<{ indivisualData: string }>('hanasysIndivisualState', { indivisualData: '' })
|
||||
const { sideNavIsOpen, setSideNavIsOpen } = useSideNavState()
|
||||
const { backBtn } = useHeaderStore()
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
export declare namespace ICommonConfig {
|
||||
export type Mode = 'local' | 'development' | 'production'
|
||||
|
||||
export interface Params {
|
||||
baseUrl: string
|
||||
mode: Mode
|
||||
}
|
||||
}
|
||||
|
||||
// local, development, production 과 관계없이 동일한 값으로 반환되는 부분은 해당 함수의 return 되는 부분만 수정하면 됩니다. (달라져야 하는 값이 아닌, 같은 값에 대해서는 local, development, production 파일을 모두 수정할 필요가 없어지게 됩니다.)
|
||||
export default function getConfigs(params: ICommonConfig.Params) {
|
||||
// local, development, production 마다 달라지는 값
|
||||
const { baseUrl, mode } = params
|
||||
|
||||
// 공통으로 반환되는 구조
|
||||
return {
|
||||
baseUrl,
|
||||
mode,
|
||||
}
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
import getConfigs from '@/config/config.common'
|
||||
|
||||
// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 development 환경에 맞는 값을 지정합니다.)
|
||||
const baseUrl = 'http://1.248.227.176:3000'
|
||||
const mode = 'development'
|
||||
|
||||
// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다.
|
||||
const configDevelopment = getConfigs({
|
||||
baseUrl,
|
||||
mode,
|
||||
})
|
||||
|
||||
export default configDevelopment
|
||||
@ -1,19 +0,0 @@
|
||||
import configDevelopment from './config.development'
|
||||
import configLocal from './config.local'
|
||||
import configProduction from './config.production'
|
||||
|
||||
// 클라이언트에서는 이 함수를 사용하여 config 값을 참조합니다.
|
||||
const Config = () => {
|
||||
switch (process.env.NEXT_PUBLIC_RUN_MODE) {
|
||||
case 'local':
|
||||
return configLocal
|
||||
case 'development':
|
||||
return configDevelopment
|
||||
case 'production':
|
||||
return configProduction
|
||||
default:
|
||||
return configLocal
|
||||
}
|
||||
}
|
||||
|
||||
export default Config
|
||||
@ -1,13 +0,0 @@
|
||||
import getConfigs from '@/config/config.common'
|
||||
|
||||
// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 local 환경에 맞는 값을 지정합니다.)
|
||||
const baseUrl = 'http://localhost:3000'
|
||||
const mode = 'local'
|
||||
|
||||
// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다.
|
||||
const configLocal = getConfigs({
|
||||
baseUrl,
|
||||
mode,
|
||||
})
|
||||
|
||||
export default configLocal
|
||||
@ -1,13 +0,0 @@
|
||||
import getConfigs from '@/config/config.common'
|
||||
|
||||
// 환경마다 달라져야 할 변수, 값들을 정의합니다. (여기는 production 환경에 맞는 값을 지정합니다.)
|
||||
const baseUrl = 'http://localhost.prod:3000'
|
||||
const mode = 'production'
|
||||
|
||||
// 환경마다 달라져야 할 값들을 getConfig 함수에 전달합니다.
|
||||
const configProduction = getConfigs({
|
||||
baseUrl,
|
||||
mode,
|
||||
})
|
||||
|
||||
export default configProduction
|
||||
@ -1,65 +1,39 @@
|
||||
import axios, { AxiosResponse, InternalAxiosRequestConfig } from 'axios'
|
||||
import Config from '@/config/config.export'
|
||||
import axios from 'axios'
|
||||
import { useSpinnerStore } from '@/store/spinnerStore'
|
||||
|
||||
export function useAxios() {
|
||||
// const { setIsShow } = useSpinnerStore()
|
||||
|
||||
const requestHandler = (config: InternalAxiosRequestConfig) => {
|
||||
// setIsShow(true)
|
||||
return config
|
||||
}
|
||||
|
||||
const responseHandler = (response: AxiosResponse) => {
|
||||
// setIsShow(false)
|
||||
response.data = transferResponse(response)
|
||||
return response
|
||||
}
|
||||
|
||||
const errorHandler = (error: any) => {
|
||||
// setIsShow(false)
|
||||
return Promise.reject(error)
|
||||
}
|
||||
|
||||
const createAxiosInstance = (url: string | null | undefined) => {
|
||||
const baseURL = url || Config().baseUrl
|
||||
return axios.create({
|
||||
baseURL,
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
},
|
||||
})
|
||||
}
|
||||
export const useAxios = () => {
|
||||
const { setIsShow } = useSpinnerStore()
|
||||
|
||||
const axiosInstance = (url: string | null | undefined) => {
|
||||
const baseURL = url || process.env.NEXT_PUBLIC_API_URL
|
||||
const instance = axios.create({
|
||||
baseURL: url || Config().baseUrl,
|
||||
baseURL,
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
},
|
||||
})
|
||||
|
||||
instance.interceptors.request.use(
|
||||
// (config) => {
|
||||
// return config
|
||||
// },
|
||||
// (error) => {
|
||||
// return Promise.reject(error)
|
||||
// },
|
||||
(config) => requestHandler(config),
|
||||
(error) => errorHandler(error),
|
||||
(config) => {
|
||||
// console.log('🚀 ~ config:', config)
|
||||
setIsShow(true)
|
||||
return config
|
||||
},
|
||||
(error) => {
|
||||
return Promise.reject(error)
|
||||
},
|
||||
)
|
||||
|
||||
instance.interceptors.response.use(
|
||||
// (response) => {
|
||||
// response.data = transferResponse(response)
|
||||
// return response
|
||||
// },
|
||||
// (error) => {
|
||||
// return Promise.reject(error)
|
||||
// },
|
||||
(response) => responseHandler(response),
|
||||
(error) => errorHandler(error),
|
||||
(response) => {
|
||||
response.data = transferResponse(response)
|
||||
setIsShow(false)
|
||||
return response
|
||||
},
|
||||
(error) => {
|
||||
// 에러 처리 로직
|
||||
return Promise.reject(error)
|
||||
},
|
||||
)
|
||||
|
||||
return instance
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { InquiryList, Inquiry, InquirySaveResponse, CommonCode } from '@/types/Inquiry'
|
||||
import { InquiryList, Inquiry, InquirySaveResponse } from '@/types/Inquiry'
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { useInquiryFilterStore } from '@/store/inquiryFilterStore'
|
||||
@ -16,7 +16,6 @@ export function useInquiry(
|
||||
isSavingInquiry: boolean
|
||||
saveInquiry: (formData: FormData) => Promise<InquirySaveResponse>
|
||||
downloadFile: (encodeFileNo: number) => Promise<File>
|
||||
commonCodeList: CommonCode[]
|
||||
} {
|
||||
const queryClient = useQueryClient()
|
||||
const { inquiryListRequest } = useInquiryFilterStore()
|
||||
@ -79,16 +78,6 @@ export function useInquiry(
|
||||
return resp.data
|
||||
}
|
||||
|
||||
const { data: commonCodeList, isLoading: isLoadingCommonCodeList } = useQuery({
|
||||
queryKey: ['commonCodeList'],
|
||||
queryFn: async () => {
|
||||
const resp = await axiosInstance(null).get<{ data: CommonCode[] }>(`/api/qna`)
|
||||
return resp.data
|
||||
},
|
||||
staleTime: Infinity,
|
||||
gcTime: Infinity,
|
||||
})
|
||||
|
||||
return {
|
||||
inquiryList: inquriyListData.inquiryList,
|
||||
inquiryDetail: inquiryDetail ?? null,
|
||||
@ -97,6 +86,5 @@ export function useInquiry(
|
||||
isSavingInquiry,
|
||||
saveInquiry,
|
||||
downloadFile,
|
||||
commonCodeList: commonCodeList?.data ?? [],
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,7 @@
|
||||
import { useAxios } from '@/hooks/useAxios'
|
||||
import { axiosInstance } from './axios'
|
||||
|
||||
export const tracking = async (params: { url: string; data: string }) => {
|
||||
const { url, data } = params
|
||||
const { axiosInstance } = useAxios()
|
||||
const result = await axiosInstance(null).post('/api/tracking', {
|
||||
url,
|
||||
data,
|
||||
|
||||
@ -10,9 +10,9 @@ export async function middleware(request: NextRequest) {
|
||||
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
||||
|
||||
// todo: 로그인 기능 추가 시 주석 해제
|
||||
// if (!session.isLoggedIn) {
|
||||
// return NextResponse.redirect(new URL('/login', request.url))
|
||||
// }
|
||||
if (!session.isLoggedIn) {
|
||||
return NextResponse.redirect(new URL('/login', request.url))
|
||||
}
|
||||
|
||||
return NextResponse.next()
|
||||
}
|
||||
@ -22,5 +22,5 @@ export async function middleware(request: NextRequest) {
|
||||
// 2. /admin/* (exclude all routes under /admin)
|
||||
// 3. /_next/* (exclude Next.js static and image assets)
|
||||
export const config = {
|
||||
matcher: ['/((?!login|assets).*)', '/((?!_next/static|_next/image|favicon.ico).*)'],
|
||||
matcher: ['/((?!dashboard|login|admin|api|_next/static|_next/image|favicon.ico).*)'],
|
||||
}
|
||||
|
||||
@ -74,12 +74,6 @@ export default function EdgeProvider({ children, sessionData }: EdgeProviderProp
|
||||
router.push('/')
|
||||
}
|
||||
}
|
||||
|
||||
if (pathname === '/') {
|
||||
if (!session?.isLoggedIn) {
|
||||
router.push('/login')
|
||||
}
|
||||
}
|
||||
//alert 함수 변경해서 바인딩
|
||||
window.alert = function (msg, alertBtn = () => setAlert(false)) {
|
||||
alertFunc(msg, alertBtn)
|
||||
|
||||
@ -98,23 +98,6 @@
|
||||
color: #8595A7;
|
||||
}
|
||||
}
|
||||
&.space{
|
||||
label{
|
||||
&::after{
|
||||
top: 8px;
|
||||
left: 0px;
|
||||
width: 10px;
|
||||
height: 2px;
|
||||
border: none;
|
||||
background-color: transparent;
|
||||
transform: translate(50%, 50%);
|
||||
-ms-transform: none;
|
||||
}
|
||||
}
|
||||
input[type="checkbox"]:checked + label::after{
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// radio box
|
||||
|
||||
@ -89,10 +89,3 @@ export type InquirySaveResponse = {
|
||||
qnaNo: number //qna number
|
||||
mailYn: string //mail yn - Y / N
|
||||
}
|
||||
|
||||
export type CommonCode = {
|
||||
headCd: string
|
||||
code: string
|
||||
name: string
|
||||
refChar1: string
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user