export function reducer()

in src/app/teller/store/customer-deposit-products.reducer.ts [31:60]


export function reducer(state = initialState, action: tellers.Actions): ResourceState {

  switch (action.type) {

    case tellers.LOAD_ALL_DEPOSIT_PRODUCTS: {
      return initialState;
    }

    case tellers.LOAD_ALL_DEPOSIT_PRODUCTS_SUCCESS: {
      const depositProducts: ProductInstance[] = action.payload;

      const ids = depositProducts.map(depositProduct => depositProduct.accountIdentifier);

      const entities = resourcesToHash(depositProducts, 'accountIdentifier');

      const loadedAt = idsToHashWithCurrentTimestamp(ids);

      return {
        ids: [ ...ids ],
        entities: entities,
        loadedAt: loadedAt,
        selectedId: state.selectedId
      };
    }

    default: {
      return state;
    }
  }
}