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

First post tested!

This commit is contained in:
Zhiyuan Zheng
2020-11-15 22:33:09 +01:00
parent 8013f6b9a2
commit 188b97fbd8
6 changed files with 141 additions and 99 deletions

View File

@ -6,6 +6,7 @@ const client = async ({
method,
instance,
endpoint,
headers,
query,
body
}: {
@ -13,6 +14,7 @@ const client = async ({
method: 'get' | 'post' | 'delete'
instance: 'local' | 'remote'
endpoint: string
headers?: { [key: string]: string }
query?: {
[key: string]: string | number | boolean
}
@ -28,6 +30,7 @@ const client = async ({
searchParams: query,
headers: {
'Content-Type': 'application/json',
...headers,
...(instance === 'local' && {
Authorization: `Bearer ${state.localToken}`
})