File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { NextRequest , NextResponse } from 'next/server' ;
22// import { getAuth } from 'firebase-admin/auth';
3- import { initializeApp , getApps , cert } from 'firebase-admin/app' ;
3+ // import { initializeApp, getApps, cert } from 'firebase-admin/app';
44import { serialize } from 'cookie' ;
55
6- const serviceAccount = {
7- projectId : process . env . FIREBASE_PROJECT_ID ,
8- privateKey : process . env . FIREBASE_PRIVATE_KEY ?. replace ( / \\ n / g, '\n' ) ,
9- clientEmail : process . env . FIREBASE_CLIENT_EMAIL ,
10- } ;
11-
12- if ( ! getApps ( ) . length ) {
13- initializeApp ( {
14- credential : cert ( serviceAccount as any ) ,
15- } ) ;
16- }
6+ // const serviceAccount = {
7+ // projectId: process.env.FIREBASE_PROJECT_ID,
8+ // privateKey: process.env.FIREBASE_PRIVATE_KEY?.replace(/\\n/g, '\n'),
9+ // clientEmail: process.env.FIREBASE_CLIENT_EMAIL,
10+ // };
11+
12+ // if (!getApps().length) {
13+ // initializeApp({
14+ // credential: cert(serviceAccount as any),
15+ // });
16+ // }
1717
1818export async function POST ( req : NextRequest ) {
1919 try {
Original file line number Diff line number Diff line change @@ -12,10 +12,10 @@ export function middleware(request: NextRequest) {
1212 publicRoutes . some ( ( route ) => pathname . startsWith ( route + '/' ) ) ;
1313
1414 // If no token and trying to access protected route
15- // if (!token && !isPublicRoute) {
16- // console.log(`Redirecting ${pathname} to /auth - no token`);
17- // return NextResponse.redirect(new URL('/auth', request.url));
18- // }
15+ if ( ! token && ! isPublicRoute ) {
16+ console . log ( `Redirecting ${ pathname } to /auth - no token` ) ;
17+ // return NextResponse.redirect(new URL('/auth', request.url));
18+ }
1919
2020 return NextResponse . next ( ) ;
2121}
You can’t perform that action at this time.
0 commit comments