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

Basic mentions, hashtags and links highlighting working

This commit is contained in:
Zhiyuan Zheng
2020-11-08 01:10:38 +01:00
parent 4cbba779c5
commit 97cad12850
9 changed files with 185 additions and 30 deletions

View File

@ -2,12 +2,14 @@ import store, { RootState } from 'src/stacks/common/store'
import ky from 'ky'
const client = async ({
version = 'v1',
method,
instance,
endpoint,
query,
body
}: {
version: 'v1' | 'v2'
method: 'get' | 'post' | 'delete'
instance: 'local' | 'remote'
endpoint: string
@ -16,13 +18,13 @@ const client = async ({
}
body?: object
}): Promise<any> => {
const state: RootState["instanceInfo"] = store.getState().instanceInfo
const state: RootState['instanceInfo'] = store.getState().instanceInfo
let response
try {
response = await ky(endpoint, {
method: method,
prefixUrl: `https://${state[instance]}/api/v1`,
prefixUrl: `https://${state[instance]}/api/${version}`,
searchParams: query,
headers: {
'Content-Type': 'application/json',