build ok,
This commit is contained in:
20
002_source/cms/src/middleware.ts
Normal file
20
002_source/cms/src/middleware.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import type { NextRequest } from 'next/server';
|
||||
|
||||
import { config as appConfig } from '@/config';
|
||||
import { AuthStrategy } from '@/lib/auth/strategy';
|
||||
import { supabaseMiddleware } from '@/lib/auth/supabase/middleware';
|
||||
|
||||
export async function middleware(req: NextRequest): Promise<NextResponse> {
|
||||
let res: NextResponse;
|
||||
|
||||
if (appConfig.auth.strategy === AuthStrategy.SUPABASE) {
|
||||
res = await supabaseMiddleware(req);
|
||||
} else {
|
||||
res = NextResponse.next({ headers: req.headers });
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
export const config = { matcher: ['/auth/:path*', '/dashboard/:path*'] };
|
Reference in New Issue
Block a user