From 8ae12aa022933029680e029d0dc89e83bf2023aa Mon Sep 17 00:00:00 2001 From: mrithunjay tanish shanmuganand <139517421+mrithunjay26@users.noreply.github.com> Date: Sat, 12 Oct 2024 19:34:07 -0700 Subject: [PATCH 1/2] Update route.ts --- src/app/api/searchjobs/route.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/api/searchjobs/route.ts b/src/app/api/searchjobs/route.ts index 6e88e80..9dbe0b7 100644 --- a/src/app/api/searchjobs/route.ts +++ b/src/app/api/searchjobs/route.ts @@ -10,9 +10,9 @@ export async function POST(req: Request) { try { const body = await req.json(); - let { interest, grade, page = 1 } = body; // Default to page 1 if not provided + const { interest, grade: inputGrade, page = 1 } = body; // Default to page 1 if not provided - if (!interest || !grade) { + if (!interest || !inputGrade) { return NextResponse.json({ error: 'Interest and grade are required.' }, { status: 400 }); } @@ -23,7 +23,7 @@ export async function POST(req: Request) { '11': 'JUNIORS', '12': 'SENIORS', }; - grade = gradeMap[grade] || grade.toUpperCase(); + const grade = gradeMap[inputGrade] || inputGrade.toUpperCase(); // Supported interests (uppercase as required in the tags) const interests = [ From af2bb366b935af2a6316b1193bd77d777ebc2235 Mon Sep 17 00:00:00 2001 From: mrithunjay tanish shanmuganand <139517421+mrithunjay26@users.noreply.github.com> Date: Sat, 12 Oct 2024 19:36:40 -0700 Subject: [PATCH 2/2] Update page.tsx --- src/app/opportunities/page.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/app/opportunities/page.tsx b/src/app/opportunities/page.tsx index 1154db9..aaf1e63 100644 --- a/src/app/opportunities/page.tsx +++ b/src/app/opportunities/page.tsx @@ -21,15 +21,9 @@ const Button = ({ children, className, ...props }) => ( ); -const Input = ({ className, ...props }) => ( - -); +// Removed the unused Input component export default function OpportunityFinder() { - const [location, setLocation] = useState("Washington"); const [selectedSubjects, setSelectedSubjects] = useState([]); const [selectedGrades, setSelectedGrades] = useState([]); const [loading, setLoading] = useState(false); @@ -45,7 +39,6 @@ export default function OpportunityFinder() { const currentSearchParams = JSON.stringify({ interest: selectedSubjects.join(" "), grade: selectedGrades.join(","), - location, }); if (prevSearchParams !== currentSearchParams) { @@ -66,7 +59,6 @@ export default function OpportunityFinder() { const response = await axios.post("/api/searchjobs", { interest: selectedSubjects.join(" "), grade: selectedGrades.join(","), - location: location, page: page, });