eeg_certs/frontend/src/utils/allCourses.ts
2023-08-25 17:54:30 -05:00

13 lines
354 B
TypeScript

import { createSignal } from "solid-js";
import { Course } from "../types/Course";
export const [allCourses, setAllCourses] = createSignal<Array<Course>>([]);
(() => {
// Get all courses from the API
fetch(`${import.meta.env.VITE_BACKEND_URL}/api/course`)
.then((res) => res.json())
.then((data) => setAllCourses(data));
})();