diff --git a/backend/src/server.js b/backend/src/server.js index 5fb424c..c510e76 100644 --- a/backend/src/server.js +++ b/backend/src/server.js @@ -15,9 +15,21 @@ dotenv.config({ }) const app = express() const port = 3000 +const dep = (origin, callback) => { + const allowedOrigins = [ + 'https://www.bequiet.live', + 'https://www.bequiet.vercel.app' + ]; + + if (allowedOrigins.includes(origin) || !origin) { + callback(null, true); + } else { + callback(new Error('Not allowed by CORS')); + } +}; const corsOptions = { credentials: true, - origin: (process.env.NODE_ENV === 'development')?'http://localhost:5173':'https://www.bequiet.live', + origin: (process.env.NODE_ENV === 'development')?'http://localhost:5173':dep, methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"], allowedHeaders: [ "Origin", diff --git a/frontend/src/components/Notification.jsx b/frontend/src/components/Notification.jsx index 69a07c6..b3768c9 100644 --- a/frontend/src/components/Notification.jsx +++ b/frontend/src/components/Notification.jsx @@ -43,6 +43,7 @@ const Notification = ({setIsNfnOpen}) => { setIsLoading(false) } const addUserToRoom = async(title,fromUser)=>{ + console.log(title+" "+fromUser); setBigLoader(true) try {