All files / app/src/entities/nomenclature/model delete-nomelcature-query.ts

91.66% Statements 11/12
100% Branches 1/1
50% Functions 1/2
91.66% Lines 11/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 221x           1x 2x       2x   2x 2x   2x 2x 2x 2x 2x  
import { queryDeleteWarehouseContractNomenclature } from './nomenclature-requests'
import { useMutation, UseMutationOptions } from 'react-query'
import { AxiosError, AxiosRequestConfig } from 'axios'
import { HydraError } from '@tmk/ui-kit'
import { Nomenclature, WAREHOUSE_CONTRACT_NOMENCLATURE_DELETE_PRIMARY_KEY } from '@/entities/nomenclature'
 
export const useWarehouseContractNomenclatureDelete = (
  options?: Omit<
    UseMutationOptions<Nomenclature, AxiosError<HydraError>, { id: string; warehouseId: string; contractId: string }>,
    'mutationFn'
  >,
  config?: AxiosRequestConfig
) =>
  useMutation(
    ({ id, warehouseId, contractId }) =>
      queryDeleteWarehouseContractNomenclature({ warehouseId, contractId, id })({ ...config })(),
    {
      ...options,
      mutationKey: WAREHOUSE_CONTRACT_NOMENCLATURE_DELETE_PRIMARY_KEY,
    }
  )