1234567891011121314151617 |
- import { useQuery } from '@tanstack/react-query';
- import { photosQueryKeys } from '../photos-query-keys';
- import { photosApi, type PostGetPhotosReturn } from '../photos-api';
- import type { BaseAxiosError } from '../../../../types';
- export const useGetPhotosForUserQuery = (token: string, enabled: boolean) => {
- return useQuery<PostGetPhotosReturn, BaseAxiosError>({
- queryKey: photosQueryKeys.getPhotosForUser(token),
- queryFn: async () => {
- const response = await photosApi.getPhotosForUser(token);
- return response.data;
- },
- enabled
- });
- };
|