diff --git a/src/routes/ProtectedRoute.tsx b/src/routes/ProtectedRoute.tsx
new file mode 100644
index 0000000..491550c
--- /dev/null
+++ b/src/routes/ProtectedRoute.tsx
@@ -0,0 +1,15 @@
+import { Navigate } from "react-router-dom";
+import { useAuth } from "../context/AuthContext";
+
+export const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
+ const { isAuthenticated, isLoading } = useAuth();
+
+ if (isLoading) return
로딩 중...
;
+
+ if (!isAuthenticated) {
+ alert("로그인이 필요한 서비스입니다.");
+ return
;
+ }
+
+ return <>{children}>;
+};
\ No newline at end of file
diff --git a/src/routes/protectedRoutes.tsx b/src/routes/protectedRoutes.tsx
new file mode 100644
index 0000000..9e3305b
--- /dev/null
+++ b/src/routes/protectedRoutes.tsx
@@ -0,0 +1,66 @@
+import type { RouteObject } from "react-router-dom";
+import { Navigate } from "react-router-dom";
+import PublicLayout from "../layout/PublicLayout";
+
+import { ProtectedRoute } from "./ProtectedRoute";
+
+import PostWrite from "../pages/Post/PostWritePage";
+import PostSuccess from "../pages/Post/PostSuccess";
+import PostEditPage from "../pages/Post/PostEditPage";
+
+import MyPageLayout from "../pages/MyPage/MyPageLayout";
+import ProfileEditPage from "../pages/MyPage/ProfileEditPage";
+import MyPostPage from "../pages/MyPage/MyPostPage";
+import MyLessonPage from "../pages/MyPage/MyLessonPage";
+
+export const protectedRoutes: RouteObject[] = [
+ {
+ path: "/",
+ element:
,
+ children: [
+ // 글쓰기
+ {
+ path: "post",
+ element: (
+
+
+
+ ),
+ },
+ // 작성 성공
+ {
+ path: "post/success",
+ element: (
+
+
+
+ ),
+ },
+ // 수정
+ {
+ path: "posts/edit/:postId",
+ element: (
+
+
+
+ ),
+ },
+
+ // 마이페이지 전체 보호
+ {
+ path: "my-profile",
+ element: (
+
+
+
+ ),
+ children: [
+ { index: true, element:
},
+ { path: "profile", element:
},
+ { path: "posts", element:
},
+ { path: "lessons", element:
},
+ ],
+ },
+ ],
+ },
+];
\ No newline at end of file
diff --git a/src/routes/publicRoutes.tsx b/src/routes/publicRoutes.tsx
new file mode 100644
index 0000000..fc1bb5e
--- /dev/null
+++ b/src/routes/publicRoutes.tsx
@@ -0,0 +1,57 @@
+import type { RouteObject } from "react-router-dom";
+import PublicLayout from "../layout/PublicLayout";
+
+import MainPage from "../pages/MainPage";
+import ErrorPage from "../pages/ErrorPage";
+import LoginPage from "../pages/LoginPage";
+import SearchPage from "../pages/SearchPage";
+
+import RandomFeedPage from "../pages/RandomFeedPage";
+import LuckyDrawPage from "../pages/LuckyDrawPage";
+import FavoriteFeedPage from "../pages/FavoriteFeedPage";
+import CategoryFeedPage from "../pages/CategoryFeedPage";
+import BestFeedPage from "../pages/BestFeedPage";
+
+import ServiceTerm from "../components/Terms/ServiceTerm";
+import PrivacyTerms from "../components/Terms/PrivacyTerms";
+import MarketingTerm from "../components/Terms/Marketing";
+
+import SignUpPage from "../pages/SignUp/SignUpPage";
+import FindPasswordPage from "../pages/FindPasswordPage";
+import SetNewPassWordPage from "../pages/SetNewPasswordPage";
+
+import PostDetailPage from "../pages/Post/PostDetailPage";
+
+export const publicRoutes: RouteObject[] = [
+ {
+ path: "/",
+ element:
,
+ children: [
+ { index: true, element:
},
+
+ { path: "login", element:
},
+ { path: "signup", element:
},
+
+ { path: "terms1", element:
},
+ { path: "terms2", element:
},
+ { path: "terms3", element:
},
+
+ { path: "signup", element:
},
+ { path: "find-password", element:
},
+ { path: "set-password", element:
},
+
+ { path: "search", element:
},
+ { path: "random-feed", element:
},
+ { path: "lucky-draw", element:
},
+ { path: "favorite-feed", element:
},
+ { path: "category-feed/:categoryId", element:
},
+ { path: "best-failer", element:
},
+
+ // 게시글 상세는 공개
+ { path: "posts/:postId", element:
},
+
+ // 맨 마지막
+ { path: "*", element:
},
+ ],
+ },
+];
diff --git a/vite.config.ts b/vite.config.ts
index 2f6a6d7..d2f5150 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -7,7 +7,7 @@ export default defineConfig({
server: {
proxy: {
"/api": {
- target: "http://43.201.240.13:8080",
+ target: "http://3.38.162.157:8080",
changeOrigin: true,
secure: false,
},