mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: rename lectures to activities across the app
This commit is contained in:
parent
bc2def6178
commit
7b63eb573c
51 changed files with 570 additions and 570 deletions
|
|
@ -1,11 +1,11 @@
|
|||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
|
||||
|
||||
export async function uploadNewImageFile(file: any, lecture_id: string) {
|
||||
export async function uploadNewImageFile(file: any, activity_id: string) {
|
||||
// Send file thumbnail as form data
|
||||
const formData = new FormData();
|
||||
formData.append("file_object", file);
|
||||
formData.append("lecture_id", lecture_id);
|
||||
formData.append("activity_id", activity_id);
|
||||
|
||||
return fetch(`${getAPIUrl()}blocks/image`, RequestBodyForm("POST", formData))
|
||||
.then((result) => result.json())
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
|
||||
|
||||
export async function uploadNewPDFFile(file: any, lecture_id: string) {
|
||||
export async function uploadNewPDFFile(file: any, activity_id: string) {
|
||||
// Send file thumbnail as form data
|
||||
const formData = new FormData();
|
||||
formData.append("file_object", file);
|
||||
formData.append("lecture_id", lecture_id);
|
||||
formData.append("activity_id", activity_id);
|
||||
|
||||
return fetch(`${getAPIUrl()}blocks/pdf`, RequestBodyForm("POST", formData))
|
||||
.then((result) => result.json())
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ import { getAPIUrl } from "@services/config/config";
|
|||
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
|
||||
|
||||
|
||||
export async function submitQuizBlock(lecture_id: string, data: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}blocks/quiz/${lecture_id}"`, RequestBody("POST", data))
|
||||
export async function submitQuizBlock(activity_id: string, data: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}blocks/quiz/${activity_id}"`, RequestBody("POST", data))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
|
||||
|
||||
export async function uploadNewVideoFile(file: any, lecture_id: string) {
|
||||
export async function uploadNewVideoFile(file: any, activity_id: string) {
|
||||
// Send file thumbnail as form data
|
||||
const formData = new FormData();
|
||||
formData.append("file_object", file);
|
||||
formData.append("lecture_id", lecture_id);
|
||||
formData.append("activity_id", activity_id);
|
||||
|
||||
return fetch(`${getAPIUrl()}blocks/video`, RequestBodyForm("POST", formData))
|
||||
.then((result) => result.json())
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import { getAPIUrl } from "@services/config/config";
|
||||
import { RequestBody, RequestBodyForm } from "@services/utils/requests";
|
||||
|
||||
export async function createLecture(data: any, chapter_id: any, org_id: any) {
|
||||
export async function createActivity(data: any, chapter_id: any, org_id: any) {
|
||||
data.content = {};
|
||||
// remove chapter_id from data
|
||||
delete data.chapterId;
|
||||
|
||||
|
||||
const result: any = await fetch(`${getAPIUrl()}lectures/?coursechapter_id=${chapter_id}&org_id=${org_id}`, RequestBody("POST", data))
|
||||
const result: any = await fetch(`${getAPIUrl()}activities/?coursechapter_id=${chapter_id}&org_id=${org_id}`, RequestBody("POST", data))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
|
||||
|
|
@ -16,17 +16,17 @@ export async function createLecture(data: any, chapter_id: any, org_id: any) {
|
|||
return result;
|
||||
}
|
||||
|
||||
export async function createFileLecture(file: File, type: string, data: any, chapter_id: any) {
|
||||
export async function createFileActivity(file: File, type: string, data: any, chapter_id: any) {
|
||||
// Send file thumbnail as form data
|
||||
const formData = new FormData();
|
||||
formData.append("coursechapter_id", chapter_id);
|
||||
|
||||
let endpoint = `${getAPIUrl()}lectures/video`;
|
||||
let endpoint = `${getAPIUrl()}activities/video`;
|
||||
|
||||
if (type === "video") {
|
||||
formData.append("name", data.name);
|
||||
formData.append("video_file", file);
|
||||
endpoint = `${getAPIUrl()}lectures/video`;
|
||||
endpoint = `${getAPIUrl()}activities/video`;
|
||||
}
|
||||
|
||||
const result: any = await fetch(endpoint, RequestBodyForm("POST", formData))
|
||||
|
|
@ -38,16 +38,16 @@ export async function createFileLecture(file: File, type: string, data: any, cha
|
|||
return result;
|
||||
}
|
||||
|
||||
export async function getLecture(lecture_id: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}lectures/${lecture_id}`, RequestBody("GET", null))
|
||||
export async function getActivity(activity_id: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}activities/${activity_id}`, RequestBody("GET", null))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
export async function updateLecture(data: any, lecture_id: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}lectures/${lecture_id}`, RequestBody("PUT", data))
|
||||
export async function updateActivity(data: any, activity_id: any) {
|
||||
const result: any = await fetch(`${getAPIUrl()}activities/${activity_id}`, RequestBody("PUT", data))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
|
||||
|
|
@ -23,8 +23,8 @@ export async function closeActivity(org_id: string, activity_id: string) {
|
|||
return result;
|
||||
}
|
||||
|
||||
export async function maskLectureAsComplete(org_id: string, course_id: string, lecture_id: string) {
|
||||
const result: any = await fetch(`${getAPIUrl()}activity/${org_id}/add_lecture/${course_id}/${lecture_id}`, RequestBody("POST", null))
|
||||
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))
|
||||
.then((result) => result.json())
|
||||
.catch((error) => console.log("error", error));
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue