started training report form
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user