1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
Files
tooot/src/utils/fetches/searchFetch.ts
Zhiyuan Zheng 48cab6053c Use new alias
2020-12-13 14:04:25 +01:00

24 lines
414 B
TypeScript

import client from '@api/client'
export const searchFetch = async (
{} = {},
{
type,
term,
limit = 20
}: {
type: 'accounts' | 'hashtags' | 'statuses'
term: string
limit?: number
}
) => {
const res = await client({
version: 'v2',
method: 'get',
instance: 'local',
url: 'search',
params: { type, q: term, limit }
})
return Promise.resolve(res.body[type])
}