Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/app/api/searchjobs/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

Expand All @@ -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 = [
Expand Down
10 changes: 1 addition & 9 deletions src/app/opportunities/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,9 @@ const Button = ({ children, className, ...props }) => (
</button>
);

const Input = ({ className, ...props }) => (
<input
className={`px-4 py-2 rounded-full border text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 ${className}`}
{...props}
/>
);
// Removed the unused Input component

export default function OpportunityFinder() {
const [location, setLocation] = useState<string>("Washington");
const [selectedSubjects, setSelectedSubjects] = useState<string[]>([]);
const [selectedGrades, setSelectedGrades] = useState<string[]>([]);
const [loading, setLoading] = useState<boolean>(false);
Expand All @@ -45,7 +39,6 @@ export default function OpportunityFinder() {
const currentSearchParams = JSON.stringify({
interest: selectedSubjects.join(" "),
grade: selectedGrades.join(","),
location,
});

if (prevSearchParams !== currentSearchParams) {
Expand All @@ -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,
});

Expand Down