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

544 migrate to react query v4 (#547)

* Update all imports

* Update isLoading

* Update onlineManager
This commit is contained in:
xmflsct
2022-12-10 14:47:19 +01:00
committed by GitHub
parent b449d50b78
commit 357c4039cb
48 changed files with 296 additions and 431 deletions

View File

@ -6,25 +6,26 @@ import {
UseMutationOptions,
useQuery,
UseQueryOptions
} from 'react-query'
} from '@tanstack/react-query'
export type QueryKeyRelationship = [
'Relationship',
{ id: Mastodon.Account['id'] }
]
const queryFunction = ({
const queryFunction = async ({
queryKey
}: QueryFunctionContext<QueryKeyRelationship>) => {
const { id } = queryKey[1]
return apiInstance<Mastodon.Relationship[]>({
const res = await apiInstance<Mastodon.Relationship[]>({
method: 'get',
url: `accounts/relationships`,
params: {
'id[]': id
}
}).then(res => res.body)
})
return res.body
}
const useRelationshipQuery = ({