mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: implement author roles in course management
This commit is contained in:
parent
5f302106a9
commit
4ab8f52b09
11 changed files with 623 additions and 96 deletions
|
|
@ -126,3 +126,30 @@ export async function deleteCourseFromBackend(course_uuid: any, access_token:any
|
|||
const res = await errorHandling(result)
|
||||
return res
|
||||
}
|
||||
|
||||
export async function getCourseContributors(course_uuid: string, access_token:string | null | undefined) {
|
||||
const result: any = await fetch(
|
||||
`${getAPIUrl()}courses/${course_uuid}/contributors`,
|
||||
RequestBodyWithAuthHeader('GET', null, null,access_token || undefined)
|
||||
)
|
||||
const res = await getResponseMetadata(result)
|
||||
return res
|
||||
}
|
||||
|
||||
export async function editContributor(course_uuid: string, contributor_id: string, authorship: any, authorship_status: any, access_token:string | null | undefined) {
|
||||
const result: any = await fetch(
|
||||
`${getAPIUrl()}courses/${course_uuid}/contributors/${contributor_id}?authorship=${authorship}&authorship_status=${authorship_status}`,
|
||||
RequestBodyWithAuthHeader('PUT', null, null,access_token || undefined)
|
||||
)
|
||||
const res = await getResponseMetadata(result)
|
||||
return res
|
||||
}
|
||||
|
||||
export async function applyForContributor(course_uuid: string, data: any, access_token:string | null | undefined) {
|
||||
const result: any = await fetch(
|
||||
`${getAPIUrl()}courses/${course_uuid}/apply-contributor`,
|
||||
RequestBodyWithAuthHeader('POST', data, null,access_token || undefined)
|
||||
)
|
||||
const res = await getResponseMetadata(result)
|
||||
return res
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue