Skip to content

Commit 6be934a

Browse files
committed
fix(build):removed some code in middleware and api auth cookie to fix npm run build
1 parent 291d448 commit 6be934a

2 files changed

Lines changed: 16 additions & 16 deletions

File tree

src/app/api/set-auth-cookie/route.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import { 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';
44
import { 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

1818
export async function POST(req: NextRequest) {
1919
try {

src/middleware.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)