import { createSelector } from 'reselect';

import ModalTypes from 'constants/ModalTypes';
import modalIsOpenSelectorFactory from 'state/selectors/factories/modalIsOpenSelectorFactory';

const resourcesSelector = state => state.data.resources;
const toShowSelector = state => state.ui.reservations.toShow;

const reservationSuccessModalSelector = createSelector(
  resourcesSelector,
  toShowSelector,
  modalIsOpenSelectorFactory(ModalTypes.RESERVATION_SUCCESS),
  (
    resources,
    reservationsToShow,
    show
  ) => ({
    reservationsToShow,
    resources,
    show,
  })
);

export default reservationSuccessModalSelector;

import { createStructuredSelector } from 'reselect';

import ModalTypes from 'constants/ModalTypes';
import modalIsOpenSelectorFactory from 'state/selectors/factories/modalIsOpenSelectorFactory';

const resourcesSelector = state => state.data.resources;
const toShowSelector = state => state.ui.reservations.toShow;

const reservationSuccessModalSelector = createStructuredSelector({
  reservationsToShow: toShowSelector,
  resources: resourcesSelector,
  show: modalIsOpenSelectorFactory(ModalTypes.RESERVATION_SUCCESS),
});

export default reservationSuccessModalSelector;

Use structured selector in SuccessModalSelector
Use structured selector in SuccessModalSelector

Refs #473.
