Files
jitsi-meet/react/features/welcome/route.js
Lyubo Marinov 3db557e2c9 Move roomnameGenerator.js out of features/base/util
Over time features/base/util became a bucket where people seemed to dump
just about anything they couldn't think of a better place for. That's a
trend I don't like encouraging. Given that roomnameGenerator.js is
currently used in features/welcome only, I'm fine with moving it there
for the greater good.
2017-04-14 13:14:02 -05:00

33 lines
850 B
JavaScript

/* global APP */
import { RouteRegistry } from '../base/react';
import { WelcomePage } from './components';
import { generateRoomWithoutSeparator } from './roomnameGenerator';
/**
* Register route for WelcomePage.
*/
RouteRegistry.register({
component: WelcomePage,
onEnter,
path: '/'
});
/**
* If the Welcome page/screen is disabled, generates a (random) room (name) so
* that the Welcome page/screen is skipped and the Conference page/screen is
* presented instead.
*
* @param {Object} nextState - The next Router state.
* @param {Function} replace - The function to redirect to another path.
* @returns {void}
*/
function onEnter(nextState, replace) {
if (typeof APP !== 'undefined' && !APP.settings.isWelcomePageEnabled()) {
const room = generateRoomWithoutSeparator();
replace(`/${room}`);
}
}