import { NextResponse } from 'next/server' import { cookies } from 'next/headers' import type { NextRequest } from 'next/server' import { getIronSession } from 'iron-session' import { sessionOptions } from './libs/session' import type { SessionData } from './types/Auth' export async function middleware(request: NextRequest) { const cookieStore = await cookies() const session = await getIronSession(cookieStore, sessionOptions) // todo: 로그인 기능 추가 시 주석 해제 // if (!session.isLoggedIn) { // return NextResponse.redirect(new URL('/login', request.url)) // } return NextResponse.next() } // Apply the middleware to all pages except: // 1. /dashboard (exclude this specific route) // 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).*)'], }