From 5a3607f63f44d36355d09f4062e95c72ff856348 Mon Sep 17 00:00:00 2001 From: Tudor-Ovidiu Avram Date: Thu, 15 Jul 2021 10:22:21 +0300 Subject: [PATCH] fix*(jaas) redirect to plan limit page on connection failed --- react/features/jaas/middleware.web.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/react/features/jaas/middleware.web.js b/react/features/jaas/middleware.web.js index 0e7cf83a0..7783178f2 100644 --- a/react/features/jaas/middleware.web.js +++ b/react/features/jaas/middleware.web.js @@ -1,18 +1,24 @@ import { redirectToStaticPage } from '../app/actions'; 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 { SET_DETAILS } from './actionTypes'; import { getCustomerDetails } from './actions'; 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. * @returns {Function} */ - MiddlewareRegistry.register(store => next => async action => { switch (action.type) { case CONFERENCE_JOINED: { @@ -20,6 +26,14 @@ MiddlewareRegistry.register(store => next => async action => { break; } + case CONNECTION_FAILED: { + const { error } = action; + + if (error && redirectErrors.includes(error.name)) { + store.dispatch(redirectToStaticPage('/static/planLimit.html')); + } + break; + } case SET_DETAILS: { const { status } = action.payload;