1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
This commit is contained in:
Zhiyuan Zheng
2021-12-18 19:59:38 +01:00
parent ad6c6a98b6
commit 8c9dfb839b
23 changed files with 126 additions and 112 deletions

View File

@ -14,17 +14,18 @@ type AccountWithSource = Mastodon.Account &
type QueryKeyProfile = ['Profile']
const queryKey: QueryKeyProfile = ['Profile']
const queryFunction = () => {
return apiInstance<AccountWithSource>({
const queryFunction = async () => {
const res = await apiInstance<AccountWithSource>({
method: 'get',
url: `accounts/verify_credentials`
}).then(res => res.body)
})
return res.body
}
const useProfileQuery = <TData = AccountWithSource>({
const useProfileQuery = ({
options
}: {
options?: UseQueryOptions<AccountWithSource, AxiosError, TData>
options?: UseQueryOptions<AccountWithSource, AxiosError>
}) => {
return useQuery(queryKey, queryFunction, options)
}