All files / app/src/entities/nomenclature/model get-nomeclature-production-standard-query.ts

100% Statements 20/20
100% Branches 2/2
100% Functions 1/1
100% Lines 20/20

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 22 23 24 25 26 27 28 291x             1x 1x 1x 1x 1x 1x 1x   1x 1x 1x 1x   1x 1x 1x 1x 1x 1x 1x 1x  
import { useRouter } from 'next/router'
import { queryFetchProductsStandards } from './nomenclature-requests'
import { queryFactory, QueryParams } from '@/shared/lib'
import { CollectionResponse } from '@/shared/@types'
import { SELECT_INITIAL_FILTERS } from '@/shared/config'
import { NOMENCLATURE_PRODUCTION_STANDARDS_PRIMARY_KEY, NomenclatureProductionStandart } from '../lib'
 
const nomenclatureProductionStandardCollectionQuery = queryFactory(
  NOMENCLATURE_PRODUCTION_STANDARDS_PRIMARY_KEY,
  queryFetchProductsStandards,
  SELECT_INITIAL_FILTERS
)(filters => ({
  params: filters,
}))
 
export const useNomenclatureProductionStandardCollection = (
  params?: QueryParams<CollectionResponse<NomenclatureProductionStandart>>
) => {
  const { locale } = useRouter()
 
  return nomenclatureProductionStandardCollectionQuery.useHookInitializer({
    ...params,
    filters: {
      locale,
      ...params?.filters,
    },
  })
}