1
1
import React , { useEffect } from 'react' ;
2
2
import { Provider } from 'react-redux' ;
3
+ import { Switch } from 'react-router-dom' ;
4
+
3
5
import store from './redux/store' ;
4
6
import setAuthToken from './redux/auth/auth.utils' ;
5
7
import { loadUser } from './redux/auth/auth.actions' ;
6
- import RoutesTree from './RoutesTree' ;
7
8
8
- import Header from './components/Header/Header.component' ;
9
+ import Header from './components/organisms/ Header/Header.component' ;
9
10
import Alert from './components/Alert/Alert.component' ;
11
+ import HomePage from './modules/HomePage/HomePage.component' ;
12
+ import QuestionsPage from './modules/QuestionsPage/QuestionsPage.component' ;
13
+ import AllTagsPage from './modules/AllTagsPage/AllTagsPage.component' ;
14
+ import AllUsersPage from './modules/AllUsersPage/AllUsersPage.component' ;
15
+ import Register from './modules/Register/Register.component' ;
16
+ import Login from './modules/Login/Login.component' ;
17
+ import Post from './modules/Post/Post.component' ;
18
+ import PostForm from './modules/PostForm/PostForm.component' ;
19
+ import TagPage from './modules/TagPage/TagPage.component' ;
20
+ import ProfilePage from './modules/ProfilePage/ProfilePage.component' ;
21
+ import NotFound from './modules/NotFound/NotFound.component' ;
22
+
23
+ import { BaseRoute , LayoutRoute } from './Router' ;
10
24
11
25
import './App.css' ;
12
26
@@ -24,7 +38,84 @@ const App = () => {
24
38
< div className = 'App' >
25
39
< Header />
26
40
< Alert />
27
- < RoutesTree />
41
+ < Switch >
42
+ < LayoutRoute
43
+ exact
44
+ path = '/'
45
+ title = 'CLONE Stack Overflow - Where Developers Learn, Share, & Build Careers'
46
+ >
47
+ < HomePage />
48
+ </ LayoutRoute >
49
+ < LayoutRoute
50
+ exact
51
+ path = '/questions'
52
+ title = 'All Questions - CLONE Stack Overflow'
53
+ >
54
+ < QuestionsPage />
55
+ </ LayoutRoute >
56
+ < LayoutRoute
57
+ exact
58
+ path = '/tags'
59
+ title = 'Tags - CLONE Stack Overflow'
60
+ >
61
+ < AllTagsPage />
62
+ </ LayoutRoute >
63
+ < LayoutRoute
64
+ exact
65
+ path = '/users'
66
+ title = 'Users - CLONE Stack Overflow'
67
+ >
68
+ < AllUsersPage />
69
+ </ LayoutRoute >
70
+ < BaseRoute
71
+ exact
72
+ path = '/register'
73
+ title = 'Sign Up - CLONE Stack Overflow'
74
+ >
75
+ < Register />
76
+ </ BaseRoute >
77
+ < BaseRoute
78
+ exact
79
+ path = '/login'
80
+ title = 'Log In - CLONE Stack Overflow'
81
+ >
82
+ < Login />
83
+ </ BaseRoute >
84
+ < LayoutRoute
85
+ exact
86
+ path = '/questions/:id'
87
+ title = 'Users - CLONE Stack Overflow'
88
+ >
89
+ < Post />
90
+ </ LayoutRoute >
91
+ < LayoutRoute
92
+ exact
93
+ path = '/users/:id'
94
+ title = 'Users - CLONE Stack Overflow'
95
+ >
96
+ < ProfilePage />
97
+ </ LayoutRoute >
98
+ < LayoutRoute
99
+ exact
100
+ path = '/tags/:tagname'
101
+ title = 'Users - CLONE Stack Overflow'
102
+ >
103
+ < TagPage />
104
+ </ LayoutRoute >
105
+ < BaseRoute
106
+ exact
107
+ path = '/add/question'
108
+ title = 'Ask a Question - CLONE Stack Overflow'
109
+ >
110
+ < PostForm />
111
+ </ BaseRoute >
112
+ < BaseRoute
113
+ path = '*'
114
+ title = 'Error 404'
115
+ >
116
+ < NotFound />
117
+ </ BaseRoute >
118
+ </ Switch >
28
119
</ div >
29
120
</ Provider >
30
121
) ;
0 commit comments