Skip to content

Commit 6771f08

Browse files
committed
fixed:cookies 2
1 parent a355450 commit 6771f08

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/server.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ app.use(cookieParser());
1111

1212
// CORS options
1313
const corsOptions = {
14-
origin: process.env.NODE_ENV === "production"
15-
? [
16-
"https://blog-content-management-demo.vercel.app",
17-
"https://blogcontentmanagement.netlify.app",
18-
process.env.FRONTEND_URL, // Allow custom frontend URL from env
19-
].filter(Boolean) // Remove undefined values
20-
: true, // Allow all origins in development
14+
origin:
15+
process.env.NODE_ENV === "production"
16+
? [
17+
"https://blog-content-management-demo.vercel.app",
18+
"https://blogcontentmanagement.netlify.app",
19+
...(process.env.FRONTEND_URL ? [process.env.FRONTEND_URL] : []), // Add custom frontend URL if provided
20+
]
21+
: true, // Allow all origins in development
2122
credentials: true, // allow cookies to be sent
2223
methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"], // Explicitly allow methods
2324
allowedHeaders: ["Content-Type", "Authorization", "Cookie"], // Allow headers including cookies

src/services/authServices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class AuthService {
99
email: string,
1010
password: string,
1111
name?: string,
12-
role?: "USER" | "ADMIN"
12+
role?: "USER" | "ADMIN",
1313
) {
1414
// Check if user already exists
1515
const existingUser = await prisma.user.findUnique({ where: { email } });

0 commit comments

Comments
 (0)