2018-07-02 14:50:13 +02:00
|
|
|
//@flow
|
2018-07-11 14:59:01 +02:00
|
|
|
import React from "react";
|
2018-07-02 14:50:13 +02:00
|
|
|
|
2018-07-11 14:59:01 +02:00
|
|
|
import { Route, withRouter } from "react-router";
|
2018-07-02 14:50:13 +02:00
|
|
|
|
2018-07-11 14:59:01 +02:00
|
|
|
import Repositories from "../repositories/containers/Repositories";
|
|
|
|
|
import Users from "../users/containers/Users";
|
2018-07-13 10:57:11 +02:00
|
|
|
import Login from "../containers/Login";
|
|
|
|
|
import Logout from "../containers/Logout";
|
2018-07-12 11:35:28 +02:00
|
|
|
|
2018-07-11 14:59:01 +02:00
|
|
|
import { Switch } from "react-router-dom";
|
2018-07-13 10:57:11 +02:00
|
|
|
import ProtectedRoute from "../components/ProtectedRoute";
|
2018-07-18 17:40:05 +02:00
|
|
|
import AddUser from "../users/containers/AddUser";
|
2018-07-25 13:21:49 +02:00
|
|
|
import SingleUser from "../users/containers/SingleUser";
|
2018-07-02 14:50:13 +02:00
|
|
|
|
2018-07-31 10:16:18 +02:00
|
|
|
import Groups from "../groups/containers/Groups";
|
2018-07-31 15:09:45 +02:00
|
|
|
import SingleGroup from "../groups/containers/SingleGroup";
|
|
|
|
|
import AddGroup from "../groups/containers/AddGroup";
|
2018-07-31 10:16:18 +02:00
|
|
|
|
2018-07-02 14:50:13 +02:00
|
|
|
type Props = {
|
2018-07-13 10:57:11 +02:00
|
|
|
authenticated?: boolean
|
2018-07-11 14:59:01 +02:00
|
|
|
};
|
2018-07-02 14:50:13 +02:00
|
|
|
|
|
|
|
|
class Main extends React.Component<Props> {
|
|
|
|
|
render() {
|
2018-07-13 10:57:11 +02:00
|
|
|
const { authenticated } = this.props;
|
2018-07-02 14:50:13 +02:00
|
|
|
return (
|
2018-07-12 08:23:24 +02:00
|
|
|
<div>
|
2018-07-02 14:50:13 +02:00
|
|
|
<Switch>
|
2018-07-13 10:57:11 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
exact
|
|
|
|
|
path="/"
|
|
|
|
|
component={Repositories}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
|
|
|
|
<Route exact path="/login" component={Login} />
|
|
|
|
|
<Route path="/logout" component={Logout} />
|
|
|
|
|
<ProtectedRoute
|
2018-07-18 17:40:05 +02:00
|
|
|
exact
|
2018-07-13 10:57:11 +02:00
|
|
|
path="/users"
|
|
|
|
|
component={Users}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
2018-07-18 17:40:05 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
authenticated={authenticated}
|
2018-07-25 13:21:49 +02:00
|
|
|
path="/users/add"
|
|
|
|
|
component={AddUser}
|
2018-07-18 17:40:05 +02:00
|
|
|
/>
|
2018-07-26 15:30:28 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
exact
|
|
|
|
|
path="/users/:page"
|
|
|
|
|
component={Users}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
2018-07-18 17:40:05 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
authenticated={authenticated}
|
2018-07-25 13:21:49 +02:00
|
|
|
path="/user/:name"
|
|
|
|
|
component={SingleUser}
|
2018-07-18 17:40:05 +02:00
|
|
|
/>
|
2018-07-31 10:16:18 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
exact
|
|
|
|
|
path="/groups"
|
|
|
|
|
component={Groups}
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
/>
|
2018-07-31 15:09:45 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
path="/group/:name"
|
|
|
|
|
component={SingleGroup}
|
|
|
|
|
/>
|
2018-07-31 14:43:55 +02:00
|
|
|
<ProtectedRoute
|
|
|
|
|
authenticated={authenticated}
|
|
|
|
|
path="/groups/add"
|
|
|
|
|
component={AddGroup}
|
|
|
|
|
/>
|
2018-07-02 14:50:13 +02:00
|
|
|
</Switch>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-12 08:23:24 +02:00
|
|
|
export default withRouter(Main);
|