You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

route.js 830B

1234567891011121314151617181920212223242526272829303132333435
  1. /* @flow */
  2. import { RouteRegistry } from '../base/react';
  3. import { WelcomePage } from './components';
  4. import {
  5. generateRoomWithoutSeparator,
  6. isWelcomePageAppEnabled,
  7. isWelcomePageUserEnabled
  8. } from './functions';
  9. /**
  10. * Register route for {@code WelcomePage}.
  11. */
  12. RouteRegistry.register({
  13. component: WelcomePage,
  14. onEnter,
  15. path: '/'
  16. });
  17. /**
  18. * Skips the {@code WelcomePage} if it is disabled (by the app or the user).
  19. *
  20. * @param {Object} store - The redux store.
  21. * @param {Function} replace - The function to redirect to another path.
  22. * @returns {void}
  23. */
  24. function onEnter({ getState }, replace) {
  25. if (isWelcomePageAppEnabled(getState)) {
  26. isWelcomePageUserEnabled(getState)
  27. || replace(`/${generateRoomWithoutSeparator()}`);
  28. } else {
  29. replace(undefined);
  30. }
  31. }