mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
chore: refactor block files
This commit is contained in:
parent
642e55ce2e
commit
0b2e407bf3
9 changed files with 30 additions and 87 deletions
|
|
@ -7,14 +7,14 @@ export async function uploadNewPDFFile(file: any, lecture_id: string) {
|
|||
formData.append("file_object", file);
|
||||
formData.append("lecture_id", lecture_id);
|
||||
|
||||
return fetch(`${getAPIUrl()}files/document`, RequestBodyForm("POST", formData))
|
||||
return fetch(`${getAPIUrl()}blocks/document`, RequestBodyForm("POST", formData))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
|
||||
export async function getPDFFile(file_id: string) {
|
||||
// todo : add course id to url
|
||||
return fetch(`${getAPIUrl()}files/document?file_id=${file_id}`, RequestBody("GET", null))
|
||||
return fetch(`${getAPIUrl()}blocks/document?file_id=${file_id}`, RequestBody("GET", null))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ export async function uploadNewImageFile(file: any, lecture_id: string) {
|
|||
formData.append("file_object", file);
|
||||
formData.append("lecture_id", lecture_id);
|
||||
|
||||
return fetch(`${getAPIUrl()}files/picture`, RequestBodyForm("POST", formData))
|
||||
return fetch(`${getAPIUrl()}blocks/image`, RequestBodyForm("POST", formData))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
|
||||
export async function getImageFile(file_id: string) {
|
||||
// todo : add course id to url
|
||||
return fetch(`${getAPIUrl()}files/picture?file_id=${file_id}`, RequestBody("GET", null))
|
||||
return fetch(`${getAPIUrl()}blocks/image?file_id=${file_id}`, RequestBody("GET", null))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ export async function uploadNewVideoFile(file: any, lecture_id: string) {
|
|||
formData.append("file_object", file);
|
||||
formData.append("lecture_id", lecture_id);
|
||||
|
||||
return fetch(`${getAPIUrl()}files/video`, RequestBodyForm("POST", formData))
|
||||
return fetch(`${getAPIUrl()}blocks/video`, RequestBodyForm("POST", formData))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
|
||||
export async function getVideoFile(file_id: string) {
|
||||
return fetch(`${getAPIUrl()}files/video?file_id=${file_id}`, RequestBody("GET", null))
|
||||
return fetch(`${getAPIUrl()}blocks/video?file_id=${file_id}`, RequestBody("GET", null))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue