mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: migrate activity page to server component
This commit is contained in:
parent
9b224a4331
commit
b6e5b1b616
6 changed files with 369 additions and 303 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm } from "@services/utils/ts/requests";
|
||||
import { RequestBody, RequestBodyForm, RequestBodyWithAuthHeader } from "@services/utils/ts/requests";
|
||||
|
||||
export async function createActivity(data: any, chapter_id: any, org_id: any) {
|
||||
data.content = {};
|
||||
|
|
@ -40,14 +40,20 @@ export async function createExternalVideoActivity(data: any, activity: any, chap
|
|||
// add coursechapter_id to data
|
||||
data.coursechapter_id = chapter_id;
|
||||
data.activity_id = activity.id;
|
||||
|
||||
|
||||
const result = await fetch(`${getAPIUrl()}activities/external_video?coursechapter_id=${chapter_id}`, RequestBody("POST", data, null));
|
||||
const res = await result.json();
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function getActivity(activity_id: any, next: any) {
|
||||
const result = await fetch(`${getAPIUrl()}activities/${activity_id}`, RequestBody("GET", null,next));
|
||||
const result = await fetch(`${getAPIUrl()}activities/${activity_id}`, RequestBody("GET", null, next));
|
||||
const res = await result.json();
|
||||
return res;
|
||||
}
|
||||
|
||||
export async function getActivityWithAuthHeader(activity_id: any, next: any, access_token: string) {
|
||||
const result = await fetch(`${getAPIUrl()}activities/activity_${activity_id}`, RequestBodyWithAuthHeader("GET", null, next, access_token));
|
||||
const res = await result.json();
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue