fix: improve trail api

This commit is contained in:
swve 2023-03-26 19:26:17 +02:00
parent e14ba02f97
commit 83dbdfdc05
5 changed files with 53 additions and 22 deletions

View file

@ -7,21 +7,21 @@ import { getAPIUrl } from "@services/config/config";
*/
export async function startCourse(course_id: string, org_slug: string) {
const result: any = await fetch(`${getAPIUrl()}trail/${org_slug}/add_course/${course_id}`, RequestBody("POST", null))
const result: any = await fetch(`${getAPIUrl()}trail/org_slug/${org_slug}/add_course/${course_id}`, RequestBody("POST", null))
.then((result) => result.json())
.catch((error) => console.log("error", error));
return result;
}
export async function removeCourse(course_id: string, org_slug: string) {
const result: any = await fetch(`${getAPIUrl()}trail/${org_slug}/remove_course/${course_id}`, RequestBody("POST", null))
const result: any = await fetch(`${getAPIUrl()}trail/org_slug/${org_slug}/remove_course/${course_id}`, RequestBody("POST", null))
.then((result) => result.json())
.catch((error) => console.log("error", error));
return result;
}
export async function maskActivityAsComplete(org_id: string, course_id: string, activity_id: string) {
const result: any = await fetch(`${getAPIUrl()}activity/${org_id}/add_activity/${course_id}/${activity_id}`, RequestBody("POST", null))
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))
.then((result) => result.json())
.catch((error) => console.log("error", error));
return result;