zcash-grant-system/frontend/client/Routes.tsx

36 lines
1.3 KiB
TypeScript
Raw Normal View History

import React from 'react';
import { hot } from 'react-hot-loader';
2018-09-27 20:03:53 -07:00
import { Switch, Route } from 'react-router';
import loadable from 'loadable-components';
import AuthRoute from 'components/AuthRoute';
// wrap components in loadable...import & they will be split
const Home = loadable(() => import('pages/index'));
const Create = loadable(() => import('pages/create'));
const Proposals = loadable(() => import('pages/proposals'));
const Proposal = loadable(() => import('pages/proposal'));
const Auth = loadable(() => import('pages/auth'));
const Profile = loadable(() => import('pages/profile'));
2018-09-27 20:03:53 -07:00
const Exception = loadable(() => import('pages/exception'));
import 'styles/style.less';
class Routes extends React.Component<any> {
render() {
return (
<Switch>
<Route exact path="/" component={Home} />
<Route path="/create" component={Create} />
<Route exact path="/proposals" component={Proposals} />
<Route path="/proposals/:id" component={Proposal} />
<AuthRoute exact path="/profile" component={Profile} />
<Route path="/profile/:id" component={Profile} />
<AuthRoute path="/auth" component={Auth} onlyLoggedOut />
2018-09-27 20:03:53 -07:00
<Route path="/*" render={() => <Exception type="404" />} />
</Switch>
);
}
}
export default hot(module)(Routes);