diff --git a/app/star-wars/people/[id]/page.tsx b/app/star-wars/people/[id]/page.tsx index 2c2059e..d8d4a07 100644 --- a/app/star-wars/people/[id]/page.tsx +++ b/app/star-wars/people/[id]/page.tsx @@ -1,4 +1,5 @@ import { type Person } from '../../types'; +import { Suspense } from 'react'; import { Metadata } from 'next'; import { notFound } from 'next/navigation'; import sleep from '@/util/sleep'; @@ -15,6 +16,25 @@ async function getPerson(id: string): Promise { return json; } +async function Starships({ starships }: { starships: string[] }) { + await sleep(); + const ships = await Promise.all( + starships.map(async (ship) => { + const res = await fetch(ship); + const json = await res.json(); + return json; + }) + ); + + return ( + + ); +} + export async function generateMetadata({ params }: Props): Promise { const person = await getPerson(params.id); @@ -40,6 +60,39 @@ export default async function Page({ params }: Props) {
{person.mass}
Hair Color
{person.hair_color}
+
Star Ships
+
+ + + + + + Loading... + + } + > + {/* @ts-expect-error Async Server Component */} + + +
);