bigbluebutton-Github/bigbluebutton-html5/imports/startup/client/routes.js
Oswaldo Acauan 2f741df97b Impl user-session based connections on server. Fix #5150
Implement a connectionId for each user, each time a user try to validate we change their connectionId
and end all other connections of that user.
2018-02-20 11:26:36 -03:00

60 lines
1.7 KiB
JavaScript

import React from 'react';
import { Router, Route, Redirect, IndexRoute, useRouterHistory } from 'react-router';
import { createHistory } from 'history';
import LoadingScreen from '/imports/ui/components/loading-screen/component';
import ChatContainer from '/imports/ui/components/chat/container';
import UserListContainer from '/imports/ui/components/user-list/container';
import { joinRouteHandler, logoutRouteHandler, authenticatedRouteHandler } from './auth';
import Base from './base';
const browserHistory = useRouterHistory(createHistory)({
basename: Meteor.settings.public.app.basename,
});
const disconnect = () => {
console.log(Meteor.status());
Meteor.disconnect();
console.log(Meteor.status());
};
const renderRoutes = () => (
<Router history={browserHistory} >
<Route path="/logout" onEnter={logoutRouteHandler} />
<Route
path="/join"
component={LoadingScreen}
onEnter={joinRouteHandler}
/>
<Route path="/" component={Base} onEnter={authenticatedRouteHandler} >
<IndexRoute components={{}} />
<Route name="users" path="users" components={{ userList: UserListContainer }} />
<Route
name="chat"
path="users/chat/:chatID"
components={{
userList: UserListContainer,
chat: ChatContainer,
}}
/>
<Redirect from="users/chat" to="/users/chat/public" />
</Route>
<Route
name="meeting-ended"
path="/ended/:endedCode"
component={Base}
onEnter={disconnect}
onLeave={logoutRouteHandler}
/>
<Route
name="error"
path="/error/:errorCode"
component={Base}
onEnter={disconnect}
/>
<Redirect from="*" to="/error/404" />
</Router>
);
export default renderRoutes;