Skip to content

Commit

Permalink
fix: encode department IDs
Browse files Browse the repository at this point in the history
Department IDs may contain slashes, which need to be encoded when fetching data from the API
  • Loading branch information
krzysdabro authored and Rei-x committed Sep 19, 2024
1 parent 9116465 commit 82d01ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/Accordion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import type { MockRegistration, Registration } from "@/lib/types";

const departmentOptions = [
"Filia w Legnicy [FLG]",
"Studium Języków Obcych [PRD/S1]",
"Studium Wychowania Fizycznego i Sportu [PRD/S3]",
"Studium Języków Obcych [PRK24/S1]",
"Studium Wychowania Fizycznego i Sportu [PRK24/S3]",
"Politechnika Wrocławska [PWR]",
"Wydział Architektury [W1]",
"Wydział Mechaniczny [W10]",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/createplan/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const CreatePlan = ({
throw new Error(`Invalid faculty name: ${facultyName}`);
}

const res = await fetch(`/api/data/${facultyID}`);
const res = await fetch(`/api/data/${encodeURIComponent(facultyID)}`);
if (!res.ok) {
throw new Error("Failed to fetch data");
}
Expand Down

0 comments on commit 82d01ed

Please sign in to comment.