feat: create and delete assignment activities from UI

This commit is contained in:
swve 2024-07-12 11:54:33 +02:00
parent 04c05e4f9a
commit 10e9be1d33
14 changed files with 358 additions and 14 deletions

View file

@ -0,0 +1,33 @@
import { getAPIUrl } from '@services/config/config'
import {
RequestBodyWithAuthHeader,
getResponseMetadata,
} from '@services/utils/ts/requests'
export async function createAssignment(body: any, access_token: string) {
const result: any = await fetch(
`${getAPIUrl()}assignments`,
RequestBodyWithAuthHeader('POST', body, null, access_token)
)
const res = await getResponseMetadata(result)
return res
}
// Delete an assignment
export async function deleteAssignment(assignmentUUID: string, access_token: string) {
const result: any = await fetch(
`${getAPIUrl()}assignments/${assignmentUUID}`,
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
}