All files / projects/organization-management/src/app/store/cost-centers cost-centers.selectors.ts

100% Statements 14/14
100% Branches 0/0
100% Functions 4/4
100% Lines 11/11

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 2446x   46x   46x   46x   46x   46x   46x   46x   46x   46x     4x    
import { createSelector } from '@ngrx/store';
 
import { selectRouteParam } from 'ish-core/store/core/router';
 
import { getOrganizationManagementState } from '../organization-management-store';
 
import { costCentersAdapter } from './cost-centers.reducer';
 
const getCostCentersState = createSelector(getOrganizationManagementState, state => state.costCenters);
 
export const getCostCentersLoading = createSelector(getCostCentersState, state => state.loading);
 
export const getCostCentersError = createSelector(getCostCentersState, state => state.error);
 
const { selectAll, selectEntities } = costCentersAdapter.getSelectors(getCostCentersState);
 
export const getCostCenters = selectAll;
 
export const getSelectedCostCenter = createSelector(
  selectRouteParam('CostCenterId'),
  selectEntities,
  (id, costCenters) => costCenters[id]
);