123456789101112131415161718192021222324252627 |
- import { countriesQueryKeys } from '../countries-query-keys';
- import { countriesApi, type PostGetUsersWhoVisitedCountryDataReturn } from '../countries-api';
- import type { BaseAxiosError } from '../../../../types';
- import { useMutation } from '@tanstack/react-query';
- export const useGetUsersWhoVisitedCountryMutation = () => {
- return useMutation<
- PostGetUsersWhoVisitedCountryDataReturn,
- BaseAxiosError,
- { id: number; page: number; sort?: string; age?: number; country?: string },
- PostGetUsersWhoVisitedCountryDataReturn
- >({
- mutationKey: countriesQueryKeys.getUsersWhoVisitedCountry(),
- mutationFn: async (variables) => {
- const response = await countriesApi.getUsersWhoVisitedCountry(
- variables.id,
- variables.page,
- variables.sort,
- variables.age,
- variables.country
- );
- return response.data;
- }
- });
- };
|