chore: Update environment configuration for API URL and enhance next.config.ts with rewrites and CORS headers
This commit is contained in:
parent
866de531fa
commit
58662400cb
@ -0,0 +1,3 @@
|
|||||||
|
# 모바일 디바이스로 로컬 서버 확인하려면 자신 IP 주소로 변경
|
||||||
|
# 다시 로컬에서 개발할때는 localhost로 변경
|
||||||
|
NEXT_PUBLIC_API_URL=http://localhost:3000
|
||||||
@ -0,0 +1 @@
|
|||||||
|
NEXT_PUBLIC_API_URL=http://172.30.1.35:3000
|
||||||
@ -6,6 +6,35 @@ const nextConfig: NextConfig = {
|
|||||||
sassOptions: {
|
sassOptions: {
|
||||||
includePaths: [path.join(__dirname, './src/styles')],
|
includePaths: [path.join(__dirname, './src/styles')],
|
||||||
},
|
},
|
||||||
|
async rewrites() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
source: '/:path*',
|
||||||
|
destination: `${process.env.NEXT_PUBLIC_API_URL}/:path*`,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
async headers() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
source: '/api/:path*',
|
||||||
|
headers: [
|
||||||
|
{
|
||||||
|
key: 'Access-Control-Allow-Origin',
|
||||||
|
value: '*',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'Access-Control-Allow-Methods',
|
||||||
|
value: 'GET, POST, PUT, DELETE, OPTIONS',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'Access-Control-Allow-Headers',
|
||||||
|
value: 'Content-Type, Authorization',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
export default nextConfig
|
export default nextConfig
|
||||||
|
|||||||
@ -119,8 +119,7 @@ model SD_SERVEY_SALES_BASIC_INFO {
|
|||||||
//제출일
|
//제출일
|
||||||
submission_date DateTime? @db.Date
|
submission_date DateTime? @db.Date
|
||||||
//상세정보
|
//상세정보
|
||||||
detail_info SD_SERVEY_SALES_DETAIL_INFO @relation(fields: [detail_info_id], references: [id])
|
detail_info SD_SERVEY_SALES_DETAIL_INFO?
|
||||||
detail_info_id Int @unique
|
|
||||||
created_at DateTime @default(now())
|
created_at DateTime @default(now())
|
||||||
updated_at DateTime @updatedAt
|
updated_at DateTime @updatedAt
|
||||||
}
|
}
|
||||||
@ -201,5 +200,6 @@ model SD_SERVEY_SALES_DETAIL_INFO {
|
|||||||
memo String? @db.VarChar(500)
|
memo String? @db.VarChar(500)
|
||||||
created_at DateTime @default(now())
|
created_at DateTime @default(now())
|
||||||
updated_at DateTime @updatedAt
|
updated_at DateTime @updatedAt
|
||||||
basic_info SD_SERVEY_SALES_BASIC_INFO?
|
basic_info SD_SERVEY_SALES_BASIC_INFO @relation(fields: [basic_info_id], references: [id])
|
||||||
|
basic_info_id Int @unique
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,12 +24,14 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
const cookieStore = await cookies()
|
const cookieStore = await cookies()
|
||||||
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
||||||
|
console.log('start session edit!')
|
||||||
session.username = user.username!
|
session.username = user.username!
|
||||||
session.email = user.email!
|
session.email = user.email!
|
||||||
session.isLoggedIn = true
|
session.isLoggedIn = true
|
||||||
|
console.log('end session edit!')
|
||||||
await session.save()
|
await session.save()
|
||||||
|
console.log('🚀 ~ POST ~ session:', session)
|
||||||
|
|
||||||
|
// return NextResponse.redirect(new URL(process.env.NEXT_PUBLIC_URL!, request.url))
|
||||||
return NextResponse.json(user)
|
return NextResponse.json(user)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ export default function RootLayout({
|
|||||||
}>) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
|
<body>
|
||||||
<ReactQueryProviders>{children}</ReactQueryProviders>
|
<ReactQueryProviders>{children}</ReactQueryProviders>
|
||||||
<Footer />
|
<Footer />
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -23,11 +23,11 @@ export default function SurveySales() {
|
|||||||
store: 'HWJ(T01)',
|
store: 'HWJ(T01)',
|
||||||
construction_point: 'HWJ(T01)',
|
construction_point: 'HWJ(T01)',
|
||||||
investigation_date: '2025-04-28',
|
investigation_date: '2025-04-28',
|
||||||
building_name: '한화재팬빌딩',
|
building_name: 'Hanwha Japan Building',
|
||||||
customer_name: 'Hong Gil Dong',
|
customer_name: 'Hong Gil Dong',
|
||||||
post_code: '1050013',
|
post_code: '1050013',
|
||||||
address: '서울특별시 강남구 테헤란로 14길 6 ',
|
address: 'Tokyo, Japan',
|
||||||
address_detail: '남도빌딩 2층',
|
address_detail: '1-1-1',
|
||||||
submission_status: false,
|
submission_status: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,10 +44,10 @@ export default function SurveySales() {
|
|||||||
<button className="bg-blue-500 text-white px-4 py-2 rounded-md">조회</button>
|
<button className="bg-blue-500 text-white px-4 py-2 rounded-md">조회</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4 m-4" role="alert">
|
{/* <div className="bg-orange-100 border-l-4 border-orange-500 text-orange-700 p-4 m-4" role="alert">
|
||||||
<p className="font-bold">Be Warned</p>
|
<p className="font-bold">Be Warned</p>
|
||||||
<p>기본 데이터 세팅 되어있습니다.</p>
|
<p>기본 데이터 세팅 되어있습니다.</p>
|
||||||
</div>
|
</div> */}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { SessionData, sessionOptions } from './libs/session'
|
|||||||
export async function middleware(request: NextRequest) {
|
export async function middleware(request: NextRequest) {
|
||||||
const cookieStore = await cookies()
|
const cookieStore = await cookies()
|
||||||
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
const session = await getIronSession<SessionData>(cookieStore, sessionOptions)
|
||||||
|
console.log('🚀 ~ middleware ~ session:', session)
|
||||||
if (!session.isLoggedIn) {
|
if (!session.isLoggedIn) {
|
||||||
return NextResponse.redirect(new URL('/login', request.url))
|
return NextResponse.redirect(new URL('/login', request.url))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user