Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

middleware.web.js 635B

1234567891011121314151617181920212223242526
  1. import { redirectToStaticPage } from '../app/actions';
  2. import { MiddlewareRegistry } from '../base/redux';
  3. import { SET_DETAILS } from './actionTypes';
  4. import { STATUSES } from './constants';
  5. /**
  6. * The redux middleware for jaas.
  7. *
  8. * @param {Store} store - The redux store.
  9. * @returns {Function}
  10. */
  11. MiddlewareRegistry.register(store => next => async action => {
  12. switch (action.type) {
  13. case SET_DETAILS: {
  14. const { status } = action.payload;
  15. if (status === STATUSES.BLOCKED) {
  16. store.dispatch(redirectToStaticPage('/static/planLimit.html'));
  17. }
  18. }
  19. }
  20. return next(action);
  21. });