Skip to content

Commit

Permalink
fix: router merge 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
cjy3458 committed Aug 26, 2024
1 parent f3b8979 commit 2ccc120
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 95 deletions.
2 changes: 1 addition & 1 deletion src/components/learn/learnMain/learned/Learned.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useNavigate } from "react-router-dom";
const Learned = () => {
const navigate = useNavigate();
const handleMoreClick = () => {
navigate("/learning/moreLearned", { state: { learned } });
navigate("/learnTale/moreLearned", { state: { learned } });
};

const [learned, setLearned] = useState<LearnedProps[]>([]);
Expand Down
2 changes: 1 addition & 1 deletion src/components/learn/learnMain/unLearned/UnLearned.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useNavigate } from "react-router-dom";
const UnLearned = () => {
const navigate = useNavigate();
const handleMoreClick = () => {
navigate("/learning/moreUnLearned", { state: { unLearned } });
navigate("/learnTale/moreUnLearned", { state: { unLearned } });
};
const [unLearned, setUnLearned] = useState<UnLearnedProps[]>([]);
const sliceUnLearned = unLearned.slice(0, 3);
Expand Down
110 changes: 17 additions & 93 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import TaleLearnPage from "@pages/TaleLearnPage";
import PreLearningQuestionPage from "@pages/PreLearningQuestionPage";
import MoreRecentTales from "@components/home/homeRecentTales/MoreRecentTales";
import PrivateRoute from "@utils/PrivateRoute";
import WordMore from "@components/learn/learnMain/word/WordMore";
import UnLearnedMore from "@components/learn/learnMain/unLearned/UnLearnedMore";
import LearnedMore from "@components/learn/learnMain/learned/LearnedMore";

const router = createBrowserRouter([
{
Expand All @@ -37,13 +40,25 @@ const router = createBrowserRouter([
element: <PrivateRoute element={<HomePage />} />,
},
{
path: "/more",
element: <PrivateRoute element={<MoreRecentTales />} />,
path: "/home/moreRecentTales",
element: <MoreRecentTales />,
},
{
path: "/learnTale",
element: <PrivateRoute element={<LearningPage />} />,
},
{
path: "/learnTale/moreWord",
element: <WordMore />,
},
{
path: "/learnTale/moreUnLearned",
element: <UnLearnedMore />,
},
{
path: "/learnTale/moreLearned",
element: <LearnedMore />,
},
{
path: "/createTale",
element: <PrivateRoute element={<CreateMainPage />} />,
Expand Down Expand Up @@ -75,94 +90,3 @@ const router = createBrowserRouter([
]);

export default router;
// import { createBrowserRouter } from "react-router-dom";
// import LoginPage from "@pages/LoginPage";
// import OnboardingPage from "@pages/OnboardingPage";
// import HomePage from "@pages/HomePage";
// import SplashScreen from "@pages/SplashScreen";
// import KakaoRedirect from "@pages/KakaoRedirect";
// import SelectKeywordPage from "@pages/SelectKeywordPage";
// import TaleDetailPage from "@pages/TaleDetailPage";
// import ReadTalePage from "@pages/ReadTalePage";
// import CreateMainPage from "@pages/CreateMainPage";
// import CreateTalePage from "@pages/CreateTalePage";
// import TaleLearnPage from "@pages/TaleLearnPage";
// import PreLearningQuestionPage from "@pages/PreLearningQuestionPage";
// // import LearningPage from "@pages/LearningPage";
// // import MoreRecentTales from "@components/home/homeRecentTales/MoreRecentTales";
// // import LearnedMore from "@components/learn/learnMain/learned/LearnedMore";
// // import UnLearnedMore from "@components/learn/learnMain/unLearned/UnLearnedMore";
// // import WordMore from "@components/learn/learnMain/word/WordMore";

// const router = createBrowserRouter([
// {
// path: "/",
// element: <SplashScreen />,
// },
// {
// path: "/login",
// element: <LoginPage />,
// },
// {
// path: "/onboarding",
// element: <OnboardingPage />,
// },
// {
// path: "/home",
// element: <HomePage />,
// },
// {
// path: "/createTale",
// element: <CreateMainPage />,
// },
// {
// path: "/kakao",
// element: <KakaoRedirect />,
// },
// // {
// // path: "/learnTale",
// // element: <LearningPage />,
// // },
// // {
// // path: "/home/moreRecentTales",
// // element: <MoreRecentTales />,
// // },
// // {
// // path: "/learnTale/moreWord",
// // element: <WordMore />,
// // },
// // {
// // path: "/learnTale/moreUnLearned",
// // element: <UnLearnedMore />,
// // },
// // {
// // path: "/learnTale/moreLearned",
// // element: <LearnedMore />,
// // },
// {
// path: "/selectKeyword",
// element: <SelectKeywordPage />,
// },
// {
// path: "/taleDetail",
// element: <TaleDetailPage />,
// },
// {
// path: "/create",
// element: <CreateTalePage />,
// },
// {
// path: "/readTale",
// element: <ReadTalePage />,
// },
// {
// path: "/learnTale",
// element: <PreLearningQuestionPage />,
// },
// {
// path: "/learnTale/:id",
// element: <TaleLearnPage />,
// },
// ]);

// export default router;

0 comments on commit 2ccc120

Please sign in to comment.