feat: init assignments UI and fix bugs

This commit is contained in:
swve 2024-07-12 21:28:50 +02:00
parent 10e9be1d33
commit 6a4e16ec29
16 changed files with 436 additions and 47 deletions

View file

@ -13,8 +13,23 @@ export async function createAssignment(body: any, access_token: string) {
return res
}
export async function getAssignmentFromActivityUUID(
activityUUID: string,
access_token: string
) {
const result: any = await fetch(
`${getAPIUrl()}assignments/activity/${activityUUID}`,
RequestBodyWithAuthHeader('GET', null, null, access_token)
)
const res = await getResponseMetadata(result)
return res
}
// Delete an assignment
export async function deleteAssignment(assignmentUUID: string, access_token: string) {
export async function deleteAssignment(
assignmentUUID: string,
access_token: string
) {
const result: any = await fetch(
`${getAPIUrl()}assignments/${assignmentUUID}`,
RequestBodyWithAuthHeader('DELETE', null, null, access_token)
@ -23,11 +38,29 @@ export async function deleteAssignment(assignmentUUID: string, access_token: str
return res
}
export async function deleteAssignmentUsingActivityUUID(activityUUID: string, access_token: string) {
const result: any = await fetch(
`${getAPIUrl()}assignments/activity/${activityUUID}`,
RequestBodyWithAuthHeader('DELETE', null, null, access_token)
)
const res = await getResponseMetadata(result)
return res
}
export async function deleteAssignmentUsingActivityUUID(
activityUUID: string,
access_token: string
) {
const result: any = await fetch(
`${getAPIUrl()}assignments/activity/${activityUUID}`,
RequestBodyWithAuthHeader('DELETE', null, null, access_token)
)
const res = await getResponseMetadata(result)
return res
}
// tasks
export async function createAssignmentTask(
body: any,
assignmentUUID: string,
access_token: string
) {
const result: any = await fetch(
`${getAPIUrl()}assignments/${assignmentUUID}/tasks`,
RequestBodyWithAuthHeader('POST', body, null, access_token)
)
const res = await getResponseMetadata(result)
return res
}