mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Lots of updates
This commit is contained in:
24
src/utils/queryHooks/emojis.ts
Normal file
24
src/utils/queryHooks/emojis.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import client from '@api/client'
|
||||
import { AxiosError } from 'axios'
|
||||
import { useQuery, UseQueryOptions } from 'react-query'
|
||||
|
||||
type QueryKey = ['Emojis']
|
||||
|
||||
const queryFunction = () => {
|
||||
return client<Mastodon.Emoji[]>({
|
||||
method: 'get',
|
||||
instance: 'local',
|
||||
url: 'custom_emojis'
|
||||
})
|
||||
}
|
||||
|
||||
const hookEmojis = <TData = Mastodon.Emoji[]>({
|
||||
options
|
||||
}: {
|
||||
options?: UseQueryOptions<Mastodon.Emoji[], AxiosError, TData>
|
||||
}) => {
|
||||
const queryKey: QueryKey = ['Emojis']
|
||||
return useQuery(queryKey, queryFunction, options)
|
||||
}
|
||||
|
||||
export default hookEmojis
|
Reference in New Issue
Block a user