Skip to content

Commit

Permalink
Revert "yolo"
Browse files Browse the repository at this point in the history
This reverts commit 695c68f.
  • Loading branch information
brianrahadi committed Oct 8, 2024
1 parent 695c68f commit 9282cde
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
26 changes: 1 addition & 25 deletions pages/courses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,13 @@ import { Course, Requirement, RequirementSchema } from "types/course";
import { z } from "zod";
import { SidebarCourse } from "components/SidebarCourse";

const COURSES_JSON_URL =
"https://raw.githubusercontent.com/ssss-sfu/course-explorer-script/main/result/courses.json/";

const Courses: React.FC = () => {
// Parse the JSON data using Zod schemas
const [courseShown, setCourseShown] = useState<Course | null>(null);
const [requirements, setRequirements] = useState<Requirement[]>([]);

useEffect(() => {
const fetchCourses = async () => {
try {
const response = await fetch(COURSES_JSON_URL, {
mode: "no-cors",
headers: {
"Content-Type": "application/json",
},
});

// if (!response.ok) {
// throw new Error("Failed to fetch courses data");
// }
const json = await response.json();
// console.log(json);
// const coursesJson = await response.json();
setRequirements(z.array(RequirementSchema).parse(json));
} catch (error) {
console.error(error);
}
};

fetchCourses();
setRequirements(z.array(RequirementSchema).parse(coursesJson));
}, []);

return (
Expand Down
2 changes: 1 addition & 1 deletion scripts/course-explorer-script

0 comments on commit 9282cde

Please sign in to comment.