File size: 517 Bytes
b10df03
 
92c8d86
e5f9c03
f565d19
 
a2157f5
b10df03
a2157f5
b10df03
 
 
 
 
e5f9c03
a2157f5
 
 
 
 
 
a2f4024
e5f9c03
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { fetchAllPages } from "@/utils";
import { SpaceProps } from "@/utils/type";
import { Spaces } from "@/components/spaces";

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 <Spaces spaces={spaces} />;
}