All files / app/src/entities/nomenclature/model get-nomenclature-connections-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 10x 1x   1x 10x 10x 10x   10x 10x 10x 10x 10x 10x 10x 10x  
import { useRouter } from 'next/router'
import { queryFetchConnections } from './nomenclature-requests'
import { queryFactory, QueryParams } from '@/shared/lib'
import { CollectionResponse } from '@/shared/@types'
import { SELECT_INITIAL_FILTERS } from '@/shared/config'
import { NOMENCLATURE_CONNECTIONS_PRIMARY_KEY, NomenclatureConnection } from '../lib'
 
const nomenclatureConnectionsCollectionQuery = queryFactory(
  NOMENCLATURE_CONNECTIONS_PRIMARY_KEY,
  queryFetchConnections,
  SELECT_INITIAL_FILTERS
)(filters => ({
  params: filters,
}))
 
export const useNomenclatureConnectionsCollection = (
  params?: QueryParams<CollectionResponse<NomenclatureConnection>>
) => {
  const { locale } = useRouter()
 
  return nomenclatureConnectionsCollectionQuery.useHookInitializer({
    ...params,
    filters: {
      locale,
      ...params?.filters,
    },
  })
}