Added a test page

This commit is contained in:
2025-03-16 23:42:30 +01:00
parent 04b2536aac
commit aee597acf2
3 changed files with 32 additions and 2 deletions

5
app/pages/test.tsx Normal file
View File

@@ -0,0 +1,5 @@
import type { Item } from "~/api/client";
export default function Test({ item }: { item: Item }) {
return <div>{item.name}</div>;
}

View File

@@ -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
View 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} />;
}