11import React , { useEffect } from 'react' ;
22import { Provider } from 'react-redux' ;
3+ import { Switch } from 'react-router-dom' ;
4+
35import store from './redux/store' ;
46import setAuthToken from './redux/auth/auth.utils' ;
57import { loadUser } from './redux/auth/auth.actions' ;
6- import RoutesTree from './RoutesTree' ;
78
8- import Header from './components/Header/Header.component' ;
9+ import Header from './components/organisms/ Header/Header.component' ;
910import 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' ;
1024
1125import './App.css' ;
1226
@@ -24,7 +38,84 @@ const App = () => {
2438 < div className = 'App' >
2539 < Header />
2640 < 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 >
28119 </ div >
29120 </ Provider >
30121 ) ;
0 commit comments