mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: add document pdf activity type
This commit is contained in:
parent
be57196fb7
commit
9dbd47c36f
9 changed files with 263 additions and 8 deletions
|
|
@ -17,13 +17,18 @@ export async function createFileActivity(file: File, type: string, data: any, ch
|
|||
formData.append("coursechapter_id", chapter_id);
|
||||
|
||||
let org_id = "test";
|
||||
|
||||
let endpoint = `${getAPIUrl()}activities/video?org_id=${org_id}`;
|
||||
let endpoint = "";
|
||||
|
||||
if (type === "video") {
|
||||
formData.append("name", data.name);
|
||||
formData.append("video_file", file);
|
||||
endpoint = endpoint;
|
||||
endpoint = `${getAPIUrl()}activities/video?org_id=${org_id}`;
|
||||
} else if (type === "documentpdf") {
|
||||
formData.append("pdf_file", file);
|
||||
formData.append("name", data.name);
|
||||
endpoint = `${getAPIUrl()}activities/documentpdf?org_id=${org_id}`;
|
||||
} else {
|
||||
// Handle other file types here
|
||||
}
|
||||
|
||||
const result: any = await fetch(endpoint, RequestBodyForm("POST", formData));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue