diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index 643c7aa..ff01a25 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -1,37 +1,30 @@ -import type { V2_MetaFunction } from "@remix-run/cloudflare"; +import { json, type V2_MetaFunction } from "@remix-run/cloudflare"; +import { useLoaderData } from "@remix-run/react"; +import type { IndexResponse } from "~/utils/saerro"; +import { indexQuery } from "~/utils/saerro"; + +export const loader = async () => { + return json(await indexQuery()); +}; export const meta: V2_MetaFunction = () => { - return [{ title: "New Remix App" }]; + return [{ title: "PS2.LIVE" }]; }; export default function Index() { + const data = useLoaderData(); return (
-

Welcome to Remix

+

PS2.LIVE

+

Worlds

); diff --git a/app/utils/saerro.ts b/app/utils/saerro.ts index ddbe3c1..c29b7f9 100644 --- a/app/utils/saerro.ts +++ b/app/utils/saerro.ts @@ -91,6 +91,8 @@ export const indexQuery = async (): Promise => { indexData.allWorlds.sort((a, b) => a.id - b.id); + console.log(indexData); + return indexData; };