feat: add user block

This commit is contained in:
swve 2025-04-01 22:35:17 +02:00
parent fe38020f02
commit 31c27bb70e
6 changed files with 336 additions and 4 deletions

View file

@ -7,19 +7,19 @@ import {
getResponseMetadata,
} from '@services/utils/ts/requests'
export async function getUser(user_id: string) {
export async function getUser(user_id: string, access_token?: string) {
const result = await fetch(
`${getAPIUrl()}users/id/${user_id}`,
RequestBody('GET', null, null)
access_token ? RequestBodyWithAuthHeader('GET', null, null, access_token) : RequestBody('GET', null, null)
)
const res = await errorHandling(result)
return res
}
export async function getUserByUsername(username: string) {
export async function getUserByUsername(username: string, access_token?: string) {
const result = await fetch(
`${getAPIUrl()}users/username/${username}`,
RequestBody('GET', null, null)
access_token ? RequestBodyWithAuthHeader('GET', null, null, access_token) : RequestBody('GET', null, null)
)
const res = await errorHandling(result)
return res