2021-06-25 13:28:54 +00:00
|
|
|
import { redirectToStaticPage } from '../app/actions';
|
|
|
|
import { MiddlewareRegistry } from '../base/redux';
|
2021-07-20 08:58:42 +00:00
|
|
|
|
2021-06-25 13:28:54 +00:00
|
|
|
|
|
|
|
import { SET_DETAILS } from './actionTypes';
|
|
|
|
import { STATUSES } from './constants';
|
|
|
|
|
|
|
|
/**
|
2021-07-15 07:22:21 +00:00
|
|
|
* The redux middleware for jaas.
|
2021-06-25 13:28:54 +00:00
|
|
|
*
|
|
|
|
* @param {Store} store - The redux store.
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
MiddlewareRegistry.register(store => next => async action => {
|
|
|
|
switch (action.type) {
|
|
|
|
case SET_DETAILS: {
|
|
|
|
const { status } = action.payload;
|
|
|
|
|
|
|
|
if (status === STATUSES.BLOCKED) {
|
|
|
|
store.dispatch(redirectToStaticPage('/static/planLimit.html'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
});
|