App.tsx 2.3 KB
Newer Older
Yoon, Daeki's avatar
Yoon, Daeki committed
1
import React from "react";
Yoon, Daeki's avatar
Yoon, Daeki committed
2
import { BrowserRouter, Route, Routes } from "react-router-dom";
Yoon, Daeki's avatar
Yoon, Daeki committed
3
import "tailwindcss/tailwind.css";
Lee Soobeom's avatar
Lee Soobeom committed
4
import { IntoPost } from "./post/intopost";
백승민's avatar
백승민 committed
5
import { Login, Profile, RequireAuth, Signup, Admin, ImgRewrite } from "./auth";
6
import { Header, Body } from "./home";
Kim, MinGyu's avatar
test    
Kim, MinGyu committed
7
import { Board, Posts } from "./board";
8
import Posting from "./post/posting";
Yoon, Daeki's avatar
Yoon, Daeki committed
9
import { Layout } from "./commons";
Lee Soobeom's avatar
Lee Soobeom committed
10
import { EditPost } from "./post/editpost";
Yoon, Daeki's avatar
Yoon, Daeki committed
11
12
13

export const App = () => {
  return (
백승민's avatar
theme1    
백승민 committed
14
15
    <BrowserRouter>
      <Routes>
Yoon, Daeki's avatar
Yoon, Daeki committed
16
17
        <Route element={<Layout />}>
          <Route path="/" element={<Header />}>
Kim, MinGyu's avatar
Kim, MinGyu committed
18
19
            <Route path="login" element={<Login />} />
            <Route path="signup" element={<Signup />} />
Yoon, Daeki's avatar
Yoon, Daeki committed
20
            <Route index element={<Body />} />
Kim, MinGyu's avatar
test    
Kim, MinGyu committed
21
            {/* <Route
22
23
24
25
26
27
28
              path="posting"
              element={
                <RequireAuth>
                  <Posting />
                </RequireAuth>
              }
            />
Yoon, Daeki's avatar
Yoon, Daeki committed
29
            <Route path="board" element={<Board />} />
Lee Soobeom's avatar
Lee Soobeom committed
30
            <Route path="post/:postId" element={<IntoPost />} />
Kim, MinGyu's avatar
test    
Kim, MinGyu committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
            <Route path="edit" element={<EditPost />} /> */}

            <Route path="posts" element={<Posts />}>
              <Route
                path="posting"
                element={
                  <RequireAuth>
                    <Posting />
                  </RequireAuth>
                }
              />
              <Route
                path=":postId"
                element={
                  <RequireAuth>
                    <IntoPost />
                  </RequireAuth>
                }
              />
              <Route path=":postId/edit" element={<EditPost />} />
              <Route index element={<Board />} />
            </Route>

54
55
56
57
58
59
60
61
            <Route
              path="profile"
              element={
                <RequireAuth>
                  <Profile />
                </RequireAuth>
              }
            />
Lee Soobeom's avatar
Lee Soobeom committed
62
63
64
65
66
67
68
69
            <Route
              path="admin"
              element={
                <RequireAuth>
                  <Admin />
                </RequireAuth>
              }
            />
70
            <Route path="admin/:imgId" element={<ImgRewrite />} />
Lee Soobeom's avatar
Lee Soobeom committed
71
            <Route path="rewrite" element={<ImgRewrite />} />
Yoon, Daeki's avatar
Yoon, Daeki committed
72
          </Route>
백승민's avatar
theme1    
백승민 committed
73
74
75
        </Route>
      </Routes>
    </BrowserRouter>
Yoon, Daeki's avatar
Yoon, Daeki committed
76
77
  );
};