데이터불러오기기

This commit is contained in:
2025-10-15 10:31:03 +00:00
parent ddb70018b9
commit 0ab4b037eb
5 changed files with 202 additions and 4 deletions

View File

@@ -28,10 +28,16 @@ function toInt(v: any): number {
export async function GET(request: Request) {
try {
// 세션 사용자 확인 (핸들 매핑용)
const session = await auth();
if (!session?.user?.email) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
const urlObj = new URL(request.url)
const hostHeader = (request.headers.get('host') || '').toLowerCase()
const isLocal = hostHeader.includes('localhost') || hostHeader.includes('127.0.0.1') || urlObj.hostname === 'localhost' || urlObj.hostname === '127.0.0.1'
if (!isLocal) {
// 세션 사용자 확인 (핸들 매핑용)
const session = await auth();
if (!session?.user?.email) {
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
}
}
const { searchParams } = new URL(request.url)