feat: various improvements

wip: frontend

feat: enable cascade on foreign keys

wip1

wip2

fix chapters issues

wip4
This commit is contained in:
swve 2023-11-29 22:29:48 +01:00
parent 2bf80030d7
commit 187f75e583
71 changed files with 879 additions and 568 deletions

View file

@ -6,20 +6,20 @@ import { getAPIUrl } from "@services/config/config";
GET requests are called from the frontend using SWR (https://swr.vercel.app/)
*/
export async function startCourse(course_id: string, org_slug: string) {
const result: any = await fetch(`${getAPIUrl()}trail/org_slug/${org_slug}/add_course/${course_id}`, RequestBody("POST", null, null))
export async function startCourse(course_uuid: string, org_slug: string) {
const result: any = await fetch(`${getAPIUrl()}trail/add_course/${course_uuid}`, RequestBody("POST", null, null))
const res = await errorHandling(result);
return res;
}
export async function removeCourse(course_id: string, org_slug: string) {
const result: any = await fetch(`${getAPIUrl()}trail/org_slug/${org_slug}/remove_course/${course_id}`, RequestBody("POST", null, null))
export async function removeCourse(course_uuid: string, org_slug: string) {
const result: any = await fetch(`${getAPIUrl()}trail/remove_course/${course_uuid}`, RequestBody("DELETE", null, null))
const res = await errorHandling(result);
return res;
}
export async function markActivityAsComplete(org_slug: string, course_id: string, activity_id: string) {
const result: any = await fetch(`${getAPIUrl()}trail/org_slug/${org_slug}/add_activity/course_id/${course_id}/activity_id/${activity_id}`, RequestBody("POST", null, null))
export async function markActivityAsComplete(org_slug: string, course_uuid: string, activity_id: string) {
const result: any = await fetch(`${getAPIUrl()}trail/add_activity/${activity_id}`, RequestBody("POST", null, null))
const res = await errorHandling(result);
return res;
}