All files / app/src/entities/nomenclature/model get-nomenclature-sides-query.ts

44.44% Statements 8/18
100% Branches 0/0
0% Functions 0/1
44.44% Lines 8/18

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 271x             1x 1x 1x 1x 1x   1x   1x                      
import { useRouter } from 'next/router'
import { queryFetchSides } from './nomenclature-requests'
import { queryFactory, QueryParams } from '@/shared/lib'
import { CollectionResponse } from '@/shared/@types'
import { SELECT_INITIAL_FILTERS } from '@/shared/config'
import { NOMENCLATURE_SIDES_COLLECTIONS_PRIMARY_KEY, NomenclatureSide } from '../lib'
 
const nomenclatureSidesCollectionQuery = queryFactory(
  NOMENCLATURE_SIDES_COLLECTIONS_PRIMARY_KEY,
  queryFetchSides,
  SELECT_INITIAL_FILTERS
)(filters => ({
  params: filters,
}))
 
export const useNomenclatureSidesCollection = (params?: QueryParams<CollectionResponse<NomenclatureSide>>) => {
  const { locale } = useRouter()
 
  return nomenclatureSidesCollectionQuery.useHookInitializer({
    ...params,
    filters: {
      locale,
      ...params?.filters,
    },
  })
}