13 lines
354 B
TypeScript
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));
|
|
})();
|
|
|