App.js 1.77 KB
Newer Older
Jiwon Yoon's avatar
22    
Jiwon Yoon committed
1
import { BrowserRouter as Router, Route, Redirect, Switch } from 'react-router-dom';
kusang96's avatar
kusang96 committed
2
3
import PrivateRoute from "./Components/PrivateRoute";
import AdminRoute from "./Components/AdminRoute";
Jiwon Yoon's avatar
22    
Jiwon Yoon committed
4
5
6
7
8
9
import Home from './Pages/Home';
import Login from './Pages/Login';
import Signup from './Pages/Signup';
import Product from "./Pages/Product";
import ProductsList from "./Pages/ProductsList";
import Admin from './Pages/Admin';
Jiwon Yoon's avatar
Jiwon Yoon committed
10
import ProductRegist from './Pages/ProductRegist';
Jiwon Yoon's avatar
22    
Jiwon Yoon committed
11
12
import ShoppingCart from './Pages/ShoppingCart';
import Payment from './Pages/Payment';
13
import PaymentCompleted from './Pages/PaymentCompleted';
Jiwon Yoon's avatar
22    
Jiwon Yoon committed
14
15
16
import Account from './Pages/Account';
import MainNav from './Components/MainNav';
import SubNav from './Components/SubNav';
이재연's avatar
이재연 committed
17

이재연's avatar
병합    
이재연 committed
18
function App() {
Jiwon Yoon's avatar
22    
Jiwon Yoon committed
19
20

  return (
21
    <Router>
Jiwon Yoon's avatar
22    
Jiwon Yoon committed
22
23
      <MainNav />
      <SubNav />
24
25
26
27
      <Switch>
        <Route exact path="/" component={Home} />
        <Route path="/login" component={Login} />
        <Route path="/signup" component={Signup} />
kusang96's avatar
0115    
kusang96 committed
28
        <Route path="/product/:productId" component={Product} />
박상호's avatar
박상호 committed
29
        <Route path="/categories/:main/:sub" component={ProductsList} />
30
        <Route path="/categories/:main" component={ProductsList} />
kusang96's avatar
kusang96 committed
31
32
33
34
35
36
37
38
39
40
41
42
        <AdminRoute path="/admin">
          <Admin />
        </AdminRoute>
        <AdminRoute path="/regist">
          <ProductRegist />
        </AdminRoute>
        <PrivateRoute path="/shoppingcart">
          <ShoppingCart />
        </PrivateRoute>
        <PrivateRoute path="/payment">
          <Payment />
        </PrivateRoute>
Jiwon Yoon's avatar
Jiwon Yoon committed
43
44
45
        <PrivateRoute path="/paymentcompleted">
          <PaymentCompleted />
        </PrivateRoute>
kusang96's avatar
kusang96 committed
46
47
48
        <PrivateRoute path="/account">
          <Account />
        </PrivateRoute>
49
50
51
        <Redirect path="/" to="/" />
      </Switch>
    </Router>
Jiwon Yoon's avatar
22    
Jiwon Yoon committed
52
  )
이재연's avatar
병합    
이재연 committed
53
54
}

55
export default App;