feat: use session access_tokens

This commit is contained in:
swve 2024-06-01 12:23:01 +01:00
parent 08cc97f557
commit 52f2235942
74 changed files with 413 additions and 440 deletions

View file

@ -1,7 +1,7 @@
import { getAPIUrl } from '@services/config/config'
import {
RequestBody,
RequestBodyForm,
RequestBodyFormWithAuthHeader,
errorHandling,
getResponseMetadata,
} from '@services/utils/ts/requests'
@ -15,12 +15,16 @@ export async function getUser(user_id: string) {
return res
}
export async function updateUserAvatar(user_uuid: any, avatar_file: any) {
export async function updateUserAvatar(
user_uuid: any,
avatar_file: any,
access_token: any
) {
const formData = new FormData()
formData.append('avatar_file', avatar_file)
const result: any = await fetch(
`${getAPIUrl()}users/update_avatar/${user_uuid}`,
RequestBodyForm('PUT', formData, null)
RequestBodyFormWithAuthHeader('PUT', formData, null, access_token)
)
const res = await getResponseMetadata(result)
return res