Skip to content

Commit

Permalink
fix: add basename to react router
Browse files Browse the repository at this point in the history
  • Loading branch information
DanyaIzm committed Dec 18, 2024
1 parent d61836c commit d7a774f
Showing 1 changed file with 59 additions and 56 deletions.
115 changes: 59 additions & 56 deletions src/routes/Routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,62 +22,65 @@ import ActivitiesPage from "../pages/ActivitiesPage.jsx";
const Routes = () => {
const context = useAuthContext();

const router = createBrowserRouter([
{
path: "/",
element: <PageWrapper />,
children: [
{
path: "/",
element: <ProtectedRoute Component={App} />,
},
{
path: "/register",
element: <OnlyUnauthorizedRoute Component={RegisterPage} />,
},
{
path: "/login",
element: <OnlyUnauthorizedRoute Component={LoginPage} />,
},
{
path: "/table",
element: <ProtectedRoute Component={TablePage} />,
},
{
path: "/activities",
element: <ProtectedRoute Component={ActivitiesPage} />,
},
{
path: "/titles/:id",
element: <ProtectedRoute Component={TitlePage} />,
},
{
path: "/activities/:id",
element: <ProtectedRoute Component={ActivityPage} />,
},
{
path: "/create-activity",
element: <ProtectedRoute Component={ActivityCreationPage} />,
},
{
path: "/create-title",
element: <ProtectedRoute Component={TitleCreationPage} />,
},
{
path: "/history",
element: <ProtectedRoute Component={HistoryPage} />,
},
{
path: "/error",
element: <ErrorPage />,
},
{
path: "*",
element: <ErrorPage />,
},
],
},
]);
const router = createBrowserRouter(
[
{
path: "/",
element: <PageWrapper />,
children: [
{
path: "/",
element: <ProtectedRoute Component={App} />,
},
{
path: "/register",
element: <OnlyUnauthorizedRoute Component={RegisterPage} />,
},
{
path: "/login",
element: <OnlyUnauthorizedRoute Component={LoginPage} />,
},
{
path: "/table",
element: <ProtectedRoute Component={TablePage} />,
},
{
path: "/activities",
element: <ProtectedRoute Component={ActivitiesPage} />,
},
{
path: "/titles/:id",
element: <ProtectedRoute Component={TitlePage} />,
},
{
path: "/activities/:id",
element: <ProtectedRoute Component={ActivityPage} />,
},
{
path: "/create-activity",
element: <ProtectedRoute Component={ActivityCreationPage} />,
},
{
path: "/create-title",
element: <ProtectedRoute Component={TitleCreationPage} />,
},
{
path: "/history",
element: <ProtectedRoute Component={HistoryPage} />,
},
{
path: "/error",
element: <ErrorPage />,
},
{
path: "*",
element: <ErrorPage />,
},
],
},
],
{ basename: "/timetrekah-frontend/" }
);

return (
<AuthContext.Provider value={context}>
Expand Down

0 comments on commit d7a774f

Please sign in to comment.