mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-06 21:22:36 +00:00
chore: update frontend folder
This commit is contained in:
50
frontend/web/src/routers/index.tsx
Normal file
50
frontend/web/src/routers/index.tsx
Normal file
@ -0,0 +1,50 @@
|
||||
import { createBrowserRouter } from "react-router-dom";
|
||||
import App from "../App";
|
||||
import Root from "../layouts/Root";
|
||||
import Home from "../pages/Home";
|
||||
import Setting from "../pages/Setting";
|
||||
import ShortcutDetail from "../pages/ShortcutDetail";
|
||||
import SignIn from "../pages/SignIn";
|
||||
import SignUp from "../pages/SignUp";
|
||||
import { shortcutService } from "../services";
|
||||
|
||||
const router = createBrowserRouter([
|
||||
{
|
||||
path: "/",
|
||||
element: <App />,
|
||||
children: [
|
||||
{
|
||||
path: "auth",
|
||||
element: <SignIn />,
|
||||
},
|
||||
{
|
||||
path: "auth/signup",
|
||||
element: <SignUp />,
|
||||
},
|
||||
{
|
||||
path: "",
|
||||
element: <Root />,
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
element: <Home />,
|
||||
},
|
||||
{
|
||||
path: "/shortcut/:shortcutId",
|
||||
element: <ShortcutDetail />,
|
||||
loader: async ({ params }) => {
|
||||
const shortcut = await shortcutService.getOrFetchShortcutById(Number(params.shortcutId));
|
||||
return shortcut;
|
||||
},
|
||||
},
|
||||
{
|
||||
path: "/setting",
|
||||
element: <Setting />,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
export default router;
|
Reference in New Issue
Block a user