Spaces:
Running
Running
import { fetchAllPages } from "@/utils"; | |
import { SpaceProps } from "@/utils/type"; | |
import { Spaces } from "@/components/spaces"; | |
import { Suspense } from "react"; | |
export const revalidate = 120; | |
async function getSpaces(sort: string) { | |
try { | |
const response = await fetchAllPages(sort); | |
return response as SpaceProps[]; | |
} catch { | |
return []; | |
} | |
} | |
export default async function Home({ | |
searchParams: { sort }, | |
}: { | |
searchParams: { sort: string }; | |
}) { | |
const spaces = await getSpaces(sort); | |
return ( | |
<section className="flex h-screen overflow-auto"> | |
<div className="w-full container px-6 py-10 lg:py-20 mx-auto space-y-10 lg:space-y-14"> | |
<Suspense fallback={<div>Loading...</div>}> | |
<Spaces spaces={spaces} /> | |
</Suspense> | |
</div> | |
</section> | |
); | |
} | |