bigbluebutton-Github/bigbluebutton-html5/imports/startup/client/routes.js

37 lines
1.3 KiB
JavaScript
Raw Normal View History

2016-04-29 03:02:51 +08:00
import React from 'react';
import { Router, Route, Redirect, IndexRoute,
IndexRedirect, useRouterHistory } from 'react-router';
2016-05-10 03:19:52 +08:00
import { createHistory } from 'history';
2016-04-29 03:02:51 +08:00
// route components
import AppContainer from '../../ui/components/app/container.jsx';
import {setCredentials, subscribeForData} from '../../ui/components/app/service.js';
2016-05-03 06:42:54 +08:00
import UserListContainer from '../../ui/components/user-list/UserListContainer.jsx';
import ChatContainer from '../../ui/components/chat/ChatContainer.jsx';
2016-04-29 03:02:51 +08:00
2016-05-10 03:19:52 +08:00
const browserHistory = useRouterHistory(createHistory)({
basename: '/html5client'
});
2016-05-07 03:12:28 +08:00
2016-04-29 03:02:51 +08:00
export const renderRoutes = () => (
<Router history={browserHistory}>
2016-05-13 03:50:02 +08:00
<Route path="/join/:meetingID/:userID/:authToken" onEnter={setCredentials} >
2016-05-10 03:19:52 +08:00
<IndexRedirect to="/" />
2016-05-13 03:50:02 +08:00
<Route path="/" component={AppContainer} onEnter={subscribeForData} >
2016-05-07 03:12:28 +08:00
<IndexRoute components={{}} />
2016-05-06 23:34:00 +08:00
2016-05-07 03:12:28 +08:00
<Route name="users" path="users" components={{
userList: UserListContainer,
}} />
2016-05-07 03:12:28 +08:00
<Route name="chat" path="users/chat/:chatID" components={{
userList: UserListContainer,
chat: ChatContainer,
}} />
2016-05-10 03:19:52 +08:00
<Redirect from="users/chat" to="/users/chat/public" />
2016-05-07 03:12:28 +08:00
</Route>
2016-05-10 03:19:52 +08:00
<Redirect from="*" to="/" />
2016-04-29 03:02:51 +08:00
</Route>
</Router>
);