1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

Setup of single store works for multiple timeline

This commit is contained in:
Zhiyuan Zheng
2020-10-24 02:47:57 +02:00
parent 83f6039ade
commit cda67d23f6
16 changed files with 334 additions and 330 deletions

View File

@ -1,12 +1,6 @@
export async function client (
instance,
endpoint,
query,
{ body, ...customConfig } = {}
) {
if (!instance || !endpoint) {
console.error('Missing instance or endpoint.')
return Promise.reject('Missing instance or endpoint.')
export async function client (url, query, { body, ...customConfig } = {}) {
if (!url) {
return Promise.reject('Missing URL.')
}
const headers = { 'Content-Type': 'application/json' }
@ -25,8 +19,8 @@ export async function client (
let data
try {
const response = await fetch(
`https://${instance}/api/v1/${endpoint}${
query
`https://${url}${
Object.keys(query).length
? `?${Object.keys(query)
.map(key => `${key}=${query[key]}`)
.join('&')}`