jiti-meet/react/features/welcome/route.js

36 lines
830 B
JavaScript
Raw Normal View History

2017-05-26 22:15:40 +00:00
/* @flow */
import { RouteRegistry } from '../base/react';
import { WelcomePage } from './components';
import {
generateRoomWithoutSeparator,
isWelcomePageAppEnabled,
isWelcomePageUserEnabled
} from './functions';
2017-05-26 22:15:40 +00:00
/**
* Register route for {@code WelcomePage}.
*/
RouteRegistry.register({
component: WelcomePage,
onEnter,
path: '/'
});
2016-12-12 21:13:17 +00:00
/**
* Skips the {@code WelcomePage} if it is disabled (by the app or the user).
2016-12-12 21:13:17 +00:00
*
* @param {Object} store - The redux store.
* @param {Function} replace - The function to redirect to another path.
2016-12-12 21:13:17 +00:00
* @returns {void}
*/
function onEnter({ getState }, replace) {
if (isWelcomePageAppEnabled(getState)) {
isWelcomePageUserEnabled(getState)
|| replace(`/${generateRoomWithoutSeparator()}`);
} else {
replace(undefined);
2016-12-12 21:13:17 +00:00
}
}