From 3f169bb147889ae8cb9f0c994bd803a9a961d7a8 Mon Sep 17 00:00:00 2001 From: WhiteSnake Date: Sat, 27 Apr 2024 18:23:24 +0530 Subject: [PATCH] added cors origin --- backend/src/app.js | 2 +- frontend/src/pages/Login.jsx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/app.js b/backend/src/app.js index d61b42b..0a0c0d4 100644 --- a/backend/src/app.js +++ b/backend/src/app.js @@ -5,7 +5,7 @@ import cors from 'cors' const app = express(); app.use(cors({ - origin: process.env.CORS_ORIGIN, + origin: process.env.NODE_ENV === 'production' ? process.env.PRODUCTION_CORS_ORIGIN : process.env.LOCAL_CORS_ORIGIN, credentials: true })) diff --git a/frontend/src/pages/Login.jsx b/frontend/src/pages/Login.jsx index 5917a9a..b4ca01a 100644 --- a/frontend/src/pages/Login.jsx +++ b/frontend/src/pages/Login.jsx @@ -42,6 +42,7 @@ const Login = () => { const errorMessage = error.response.data.match( /
Error: (.*?)
/ )[1]; + console.log(errorMessage) } }; const togglePasswordVisibility = () => {