import { Link, useParams } from "react-router-dom" import { useEffect, useState } from "react"; import { DbRelease } from "../server/dbal/dbal"; import { css } from "@emotion/css"; type Info = { author: string | null; games: {slug: string; releases: DbRelease[]}[]; } export const AuthorPage = () => { const {author} = useParams(); const [info, setInfo] = useState(null); useEffect(() => { const fetchInfo = async () => { let url = `/api/author?author=${author}`; const information = await fetch(url); const json = await information.json(); console.log('json', json); setInfo(json); } fetchInfo(); }, [setInfo, author]); if (!info) { return (
LOADING...
) } if (!info.author) { return (
NOT FOUND
) } return (

{author}

{ info.games.map(game => (

{game.releases[0].manifest.title ?? game.slug}

)) }
) }