mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
28 lines
617 B
TypeScript
28 lines
617 B
TypeScript
import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
|
|
|
|
import { queryClient } from '@/backend/queryClient';
|
|
|
|
import { usersApi } from './api';
|
|
|
|
export function useProfile() {
|
|
const {
|
|
data: profile,
|
|
isLoading,
|
|
error
|
|
} = useQuery({
|
|
...usersApi.getProfileQueryOptions()
|
|
});
|
|
return { profile, isLoading, error };
|
|
}
|
|
|
|
export function useProfileSuspense() {
|
|
const { data: profile } = useSuspenseQuery({
|
|
...usersApi.getProfileQueryOptions()
|
|
});
|
|
return { profile };
|
|
}
|
|
|
|
export function prefetchProfile() {
|
|
return queryClient.prefetchQuery(usersApi.getProfileQueryOptions());
|
|
}
|