Added a test page
This commit is contained in:
5
app/pages/test.tsx
Normal file
5
app/pages/test.tsx
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import type { Item } from "~/api/client";
|
||||||
|
|
||||||
|
export default function Test({ item }: { item: Item }) {
|
||||||
|
return <div>{item.name}</div>;
|
||||||
|
}
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
import { type RouteConfig, index } from "@react-router/dev/routes";
|
import { type RouteConfig, index, route } from "@react-router/dev/routes";
|
||||||
|
|
||||||
export default [index("routes/home.tsx")] satisfies RouteConfig;
|
export default [
|
||||||
|
index("routes/home.tsx"),
|
||||||
|
route("/test", "routes/test.tsx"),
|
||||||
|
] satisfies RouteConfig;
|
||||||
|
|||||||
22
app/routes/test.tsx
Normal file
22
app/routes/test.tsx
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import type { Route } from "./+types/home";
|
||||||
|
import Test from "../pages/test";
|
||||||
|
import client from "~/api/client";
|
||||||
|
import type { Item } from "~/api/client";
|
||||||
|
|
||||||
|
export function meta({}: Route.MetaArgs) {
|
||||||
|
return [
|
||||||
|
{ title: "Aindustries' casino" },
|
||||||
|
{ name: "description", content: "Welcome to React Router!" },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function clientLoader() {
|
||||||
|
let item = await client.GET("/item", {
|
||||||
|
query: { uuid: "eee91ea1-1827-482b-b298-63bd6eda0221" },
|
||||||
|
});
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function TestPage({ loaderData: item }: { loaderData: Item }) {
|
||||||
|
return <Test item={item} />;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user