2025-01-27 15:03:48 +03:00
|
|
|
import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
|
|
|
|
|
2025-01-29 23:18:20 +03:00
|
|
|
import { queryClient } from '@/backend/queryClient';
|
|
|
|
|
2025-01-27 15:03:48 +03:00
|
|
|
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 };
|
|
|
|
}
|
2025-01-29 23:18:20 +03:00
|
|
|
|
|
|
|
export function prefetchProfile() {
|
|
|
|
return queryClient.prefetchQuery(usersApi.getProfileQueryOptions());
|
|
|
|
}
|