started training report form

This commit is contained in:
2025-11-17 19:28:09 -05:00
parent cbefff34f5
commit 28d4607768
5 changed files with 125 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
import { CourseEventDetails, CourseEventSummary } from '@shared/types/course'
import { Course, CourseEventDetails, CourseEventSummary } from '@shared/types/course'
//@ts-ignore
const addr = import.meta.env.VITE_APIHOST;
@@ -23,4 +23,15 @@ export async function getTrainingReport(id: number): Promise<CourseEventDetails>
console.error("Something went wrong");
throw new Error("Failed to load training reports");
}
}
export async function getAllTrainings(): Promise<Course[]> {
const res = await fetch(`${addr}/course`);
if (res.ok) {
return await res.json() as Promise<Course[]>;
} else {
console.error("Something went wrong");
throw new Error("Failed to load training list");
}
}