2016-04-29 03:02:51 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { Router, Route, Redirect, IndexRoute, browserHistory } from 'react-router';
|
|
|
|
|
|
|
|
// route components
|
2016-05-03 06:42:54 +08:00
|
|
|
import AppContainer from '../../ui/components/app/AppContainer.jsx';
|
|
|
|
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-04 04:40:46 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
TODO: Find out how to set a baseURL or something alike
|
|
|
|
so we dont need to mannualy say `html5client` in every route/link
|
|
|
|
*/
|
2016-04-29 03:02:51 +08:00
|
|
|
export const renderRoutes = () => (
|
|
|
|
<Router history={browserHistory}>
|
|
|
|
<Route path="/html5client" component={AppContainer}>
|
2016-05-03 06:42:54 +08:00
|
|
|
<IndexRoute components={{}} />
|
2016-05-04 04:40:46 +08:00
|
|
|
<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="/html5client/users/chat/public" />
|
2016-04-29 03:02:51 +08:00
|
|
|
<Redirect from="*" to="/html5client" />
|
|
|
|
</Route>
|
|
|
|
</Router>
|
|
|
|
);
|