tooot/src/stacks/common/searchFetch.ts

24 lines
415 B
TypeScript

import client from 'src/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',
endpoint: 'search',
query: { type, q: term, limit }
})
return Promise.resolve(res.body)
}