web: start using graphql-codegen, switch to urql, use graphql data a few places

This commit is contained in:
2024-05-10 04:45:53 +02:00
parent 97cfb05710
commit 6f021e4842
16 changed files with 5855 additions and 374 deletions

View File

@ -1,12 +1,25 @@
import { graphql } from "@/gql";
import {EventFragment} from "@/gql/graphql"
import { getClient } from "@/app/client";
import { EventList } from "@/components/events/EventList";
import { Body } from "@/components/general/Body";
import Image from "next/image";
export default function Home() {
export default async function Home() {
const homeQuery = graphql(`
query home {
events: pages(contentType: "events.EventPage") {
...Event
}
}
`);
const { data, error } = await getClient().query(homeQuery, {});
const events = (data?.events ?? []) as EventFragment[]
return (
<main className="site-main" id="main">
<div>
<EventList />
<EventList events={events} />
<blockquote>«Hvor Glæden hersker, er alltid Fest»</blockquote>
<p className="lead">
Sed sodales nunc quis sapien malesuada, a faucibus turpis blandit.