diff options
| author | Yuren Hao <97327730+YurenHao0426@users.noreply.github.com> | 2025-08-06 02:11:57 -0700 |
|---|---|---|
| committer | Yuren Hao <97327730+YurenHao0426@users.noreply.github.com> | 2025-08-06 02:11:57 -0700 |
| commit | ecfbb5c0ff41333363c7615d4a51acecc06c72a3 (patch) | |
| tree | e6cf818423afd2c9b6ae168f3150c7d36021ecdf /src/hooks | |
| parent | 79ec5fd1f0188a88f937737185c542e644cf98e4 (diff) | |
fix: handle namespace and add proxy support32yry8-codex/test-uiuc-api-cors-response
Diffstat (limited to 'src/hooks')
| -rw-r--r-- | src/hooks/useCourseData.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/hooks/useCourseData.ts b/src/hooks/useCourseData.ts new file mode 100644 index 0000000..74281fa --- /dev/null +++ b/src/hooks/useCourseData.ts @@ -0,0 +1,14 @@ +import { useEffect, useState } from "react"; + +export function useCourseData(file = "/data/catalog_2025_fall.json") { + const [catalog, setCatalog] = useState<Record<string, string[]>>({}); + + useEffect(() => { + fetch(file) + .then(r => r.json()) + .then(setCatalog) + .catch(console.error); + }, [file]); + + return catalog; +} |
