Migrate to local PG & Update Solana Checkout
This commit is contained in:
31
proxy.ts
31
proxy.ts
@@ -1,20 +1,19 @@
|
||||
import { type NextRequest } from 'next/server'
|
||||
import { updateSession } from '@/utils/supabase/proxy'
|
||||
import { NextResponse } from 'next/server';
|
||||
import type { NextRequest } from 'next/server';
|
||||
|
||||
export async function proxy(request: NextRequest) {
|
||||
return await updateSession(request)
|
||||
export function proxy(request: NextRequest) {
|
||||
const adminSession = request.cookies.get('admin_session');
|
||||
|
||||
// Protect /admin routes
|
||||
if (request.nextUrl.pathname.startsWith('/admin')) {
|
||||
if (!adminSession) {
|
||||
return NextResponse.redirect(new URL('/login', request.url));
|
||||
}
|
||||
}
|
||||
|
||||
return NextResponse.next();
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: [
|
||||
/*
|
||||
* Match all request paths except for the ones starting with:
|
||||
* - _next/static (static files)
|
||||
* - _next/image (image optimization files)
|
||||
* - favicon.ico (favicon file)
|
||||
* - public files (images, etc)
|
||||
* Feel free to modify this pattern to include more paths.
|
||||
*/
|
||||
'/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).*)',
|
||||
],
|
||||
}
|
||||
matcher: ['/admin/:path*'],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user