mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Basic toot in timeline working
This commit is contained in:
@ -13,21 +13,19 @@ export async function client (url, query, { body, ...customConfig } = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
const queryString = query
|
||||
? `?${Object.keys(query)
|
||||
.map(key => `${key}=${query[key]}`)
|
||||
.join('&')}`
|
||||
: ''
|
||||
|
||||
if (body) {
|
||||
config.body = JSON.stringify(body)
|
||||
}
|
||||
|
||||
let data
|
||||
try {
|
||||
const response = await fetch(
|
||||
`https://${url}${
|
||||
Object.keys(query).length
|
||||
? `?${Object.keys(query)
|
||||
.map(key => `${key}=${query[key]}`)
|
||||
.join('&')}`
|
||||
: ''
|
||||
}`,
|
||||
config
|
||||
)
|
||||
const response = await fetch(`https://${url}${queryString}`, config)
|
||||
data = await response.json()
|
||||
if (response.ok) {
|
||||
return data
|
||||
|
Reference in New Issue
Block a user