Skip to content

Commit 596ce1e

Browse files
committed
refactor: move pages to folder
1 parent c1b3ccf commit 596ce1e

File tree

13 files changed

+68
-165
lines changed

13 files changed

+68
-165
lines changed

client/src/App.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import React, { Component } from 'react';
2+
import { Route, Switch, Redirect, withRouter } from 'react-router-dom';
3+
4+
import withState from './../utils/withState';
5+
6+
import PrivateRoute from './utils/PrivateRoute';
7+
8+
import Header from './components/Header';
9+
import Dashboard from './pages/Dashboard/';
10+
import Landing from './pages/Landing/';
11+
import Login from './pages/Login/';
12+
import Register from './pages/Register/';
13+
import NotFound from './pages/NotFound/';
14+
15+
class App extends Component {
16+
componentDidMount() {
17+
this.unlisten = this.props.history.listen((location, action) => {
18+
if (this.props.store.error !== '') {
19+
this.props.actions.clearErrors();
20+
}
21+
});
22+
}
23+
24+
componentWillUnmount() {
25+
this.unlisten();
26+
}
27+
28+
render() {
29+
const {
30+
store: { isLoggedIn }
31+
} = this.props;
32+
33+
return (
34+
<div className="App">
35+
<Header />
36+
37+
<Switch>
38+
<Route exact path="/" component={Landing} />
39+
<PrivateRoute path="/dashboard" component={Dashboard} />
40+
<Route
41+
path="/login"
42+
render={() =>
43+
isLoggedIn ? (
44+
<Redirect to="/dashboard" />
45+
) : (
46+
<Login />
47+
)
48+
}
49+
/>
50+
<Route
51+
path="/register"
52+
render={() =>
53+
isLoggedIn ? (
54+
<Redirect to="/dashboard" />
55+
) : (
56+
<Register />
57+
)
58+
}
59+
/>
60+
61+
<NotFound />
62+
</Switch>
63+
</div>
64+
);
65+
}
66+
}
67+
68+
export default withRouter(withState(App));

client/src/logic/index.js

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)