fix: session auth issues

This commit is contained in:
swve 2024-05-27 20:58:32 +02:00
parent 1708b36818
commit 08cc97f557
70 changed files with 607 additions and 427 deletions

View file

@ -1,10 +1,14 @@
import { getAPIUrl } from '@services/config/config'
import { RequestBody, getResponseMetadata } from '@services/utils/ts/requests'
import {
RequestBody,
RequestBodyWithAuthHeader,
getResponseMetadata,
} from '@services/utils/ts/requests'
export async function createCourseUpdate(body: any) {
export async function createCourseUpdate(body: any, access_token: string) {
const result: any = await fetch(
`${getAPIUrl()}courses/${body.course_uuid}/updates`,
RequestBody('POST', body, null)
RequestBodyWithAuthHeader('POST', body, null, access_token)
)
const res = await getResponseMetadata(result)
return res
@ -12,11 +16,12 @@ export async function createCourseUpdate(body: any) {
export async function deleteCourseUpdate(
course_uuid: string,
update_uuid: number
update_uuid: number,
access_token: string
) {
const result: any = await fetch(
`${getAPIUrl()}courses/${course_uuid}/update/${update_uuid}`,
RequestBody('DELETE', null, null)
RequestBodyWithAuthHeader('DELETE', null, null, access_token)
)
const res = await getResponseMetadata(result)
return res