Skip to content

Commit 91c2d8a

Browse files
committed
fix: CORS updation
1 parent 9eaca28 commit 91c2d8a

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

leaderboard_backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "",
55
"main": "server.js",
66
"scripts": {
7-
"start": "nodemon server.js",
7+
"start": "node server.js",
88
"dev": "nodemon server.js",
99
"test": "echo \"Error: no test specified\" && exit 1"
1010
},

leaderboard_backend/server.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ connectToDb();
1414

1515
// Middlewares
1616
app.use(cors({
17-
origin: ['http://localhost:3000', 'http://localhost:3001'], // Add your frontend URLs
18-
credentials: true
17+
origin: ['http://localhost:3000', 'https://notes-aid.minavkaria.tech', 'https://notes-aid-git-fork-om-thanage-main-minavkarias-projects.vercel.app', 'https://notes-d0qrfpgl6-minavkarias-projects.vercel.app'
18+
],
19+
credentials: true,
20+
methods: ['GET', 'OPTIONS'],
21+
allowedHeaders: ['Content-Type', 'Authorization'],
1922
}));
2023
app.use(express.json());
2124
app.use(express.urlencoded({ extended: true }));

notes-aid/src/components/Leaderboard.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useState, useEffect, useMemo } from 'react';
44
import { Card, CardContent } from './ui/Card';
55
import { Input } from './ui/Input';
66
import { useDebounce } from '../hook/useDebounce';
7-
import { Search, Trophy, Medal, Award, Users, ChevronLeft, ChevronRight, RefreshCw, Star, X, BarChart3, ChevronDown } from 'lucide-react';
7+
import { Search, Trophy, Medal, Award, Users, ChevronLeft, ChevronRight, RefreshCw, Star, X, BarChart3 } from 'lucide-react';
88
import { parseCookies } from 'nookies';
99

1010
const getApiUrl = (endpoint: string) => {
@@ -146,7 +146,7 @@ export default function Leaderboard() {
146146
};
147147

148148
fetchAvailableYears();
149-
}, [isHydrated, token]); // Wait for hydration and token // Fetch available semesters when year changes
149+
}, [isHydrated, token]);
150150
useEffect(() => {
151151
const fetchAvailableSemesters = async () => {
152152
if (!selectedYear || !token) return;
@@ -470,7 +470,6 @@ export default function Leaderboard() {
470470
</option>
471471
))}
472472
</select>
473-
<ChevronDown className="w-5 h-5 text-neutral-content absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none" />
474473
</div>
475474

476475
{/* Semester Selection */}

0 commit comments

Comments
 (0)