moved npm from middleware to proxy
This commit is contained in:
@@ -1,25 +0,0 @@
|
|||||||
import { NextResponse, type NextRequest } from 'next/server'
|
|
||||||
|
|
||||||
const PUBLIC_PATHS = ['/login', '/api/auth']
|
|
||||||
|
|
||||||
export function middleware(request: NextRequest) {
|
|
||||||
const { pathname } = request.nextUrl
|
|
||||||
|
|
||||||
if (PUBLIC_PATHS.some((p) => pathname.startsWith(p))) {
|
|
||||||
return NextResponse.next()
|
|
||||||
}
|
|
||||||
|
|
||||||
const session = request.cookies.get('better-auth.session_token')
|
|
||||||
|
|
||||||
if (!session) {
|
|
||||||
return NextResponse.redirect(new URL('/login', request.url))
|
|
||||||
}
|
|
||||||
|
|
||||||
return NextResponse.next()
|
|
||||||
}
|
|
||||||
|
|
||||||
export const config = {
|
|
||||||
matcher: [
|
|
||||||
'/((?!_next/static|_next/image|favicon.ico|icons|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
|
|
||||||
],
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user