fix*(jaas) redirect to plan limit page on connection failed

This commit is contained in:
Tudor-Ovidiu Avram 2021-07-15 10:22:21 +03:00 committed by Horatiu Muresan
parent d57e202d19
commit 5a3607f63f
1 changed files with 16 additions and 2 deletions

View File

@ -1,18 +1,24 @@
import { redirectToStaticPage } from '../app/actions'; import { redirectToStaticPage } from '../app/actions';
import { CONFERENCE_JOINED } from '../base/conference/actionTypes'; import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
import { CONNECTION_FAILED } from '../base/connection';
import { JitsiConnectionErrors } from '../base/lib-jitsi-meet';
import { MiddlewareRegistry } from '../base/redux'; import { MiddlewareRegistry } from '../base/redux';
import { SET_DETAILS } from './actionTypes'; import { SET_DETAILS } from './actionTypes';
import { getCustomerDetails } from './actions'; import { getCustomerDetails } from './actions';
import { STATUSES } from './constants'; import { STATUSES } from './constants';
const redirectErrors = [
JitsiConnectionErrors.CONNECTION_DROPPED_ERROR,
JitsiConnectionErrors.PASSWORD_REQUIRED
];
/** /**
* The redux middleware for billing counter. * The redux middleware for jaas.
* *
* @param {Store} store - The redux store. * @param {Store} store - The redux store.
* @returns {Function} * @returns {Function}
*/ */
MiddlewareRegistry.register(store => next => async action => { MiddlewareRegistry.register(store => next => async action => {
switch (action.type) { switch (action.type) {
case CONFERENCE_JOINED: { case CONFERENCE_JOINED: {
@ -20,6 +26,14 @@ MiddlewareRegistry.register(store => next => async action => {
break; break;
} }
case CONNECTION_FAILED: {
const { error } = action;
if (error && redirectErrors.includes(error.name)) {
store.dispatch(redirectToStaticPage('/static/planLimit.html'));
}
break;
}
case SET_DETAILS: { case SET_DETAILS: {
const { status } = action.payload; const { status } = action.payload;