use-post-get-users-who-visited-dare.tsx 848 B

123456789101112131415161718192021222324252627
  1. import { regionQueryKeys } from '../regions-query-keys';
  2. import { regionsApi, type PostGetUsersWhoVisitedDataReturn } from '../regions-api';
  3. import type { BaseAxiosError } from '../../../../types';
  4. import { useMutation } from '@tanstack/react-query';
  5. export const useGetUsersWhoVisitedDareMutation = () => {
  6. return useMutation<
  7. PostGetUsersWhoVisitedDataReturn,
  8. BaseAxiosError,
  9. { id: number; page: number; sort?: string; age?: number; country?: string },
  10. PostGetUsersWhoVisitedDataReturn
  11. >({
  12. mutationKey: regionQueryKeys.getUsersWhoVisitedDare(),
  13. mutationFn: async (variables) => {
  14. const response = await regionsApi.getUsersWhoVisitedDare(
  15. variables.id,
  16. variables.page,
  17. variables.sort,
  18. variables.age,
  19. variables.country
  20. );
  21. return response.data;
  22. }
  23. });
  24. };