-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpage.tsx
More file actions
39 lines (35 loc) · 1.07 KB
/
Copy pathpage.tsx
File metadata and controls
39 lines (35 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import ListContainer from "@/components/ListContainer";
import Search from "@/components/Search";
import { pullLatestNChanges } from "@/libs/pullData";
export const revalidate = 3600 / 6;
// Fetch data from GitHub
const getData = async (
): Promise<
{ commitList: any } | undefined
> => {
try {
return pullLatestNChanges(1);
} catch (error: any) {
throw new Error(error.message);
}
};
const Home = async ({
searchParams,
}: {
searchParams: { [key: string]: string | string[] | undefined };
}) => {
const searchTerms: string = searchParams.searchterms as string;
const { commitList }: any = await getData();
// Workaround from Next.JS GitHub
// https://github.com/vercel/next.js/issues/42292#issuecomment-1464048350
const listContainer: JSX.Element = await ListContainer({ commitList, searchTerms })
return (
<section className="container max-w-5xl mx-auto ">
<Search searchTerms={searchTerms} />
<div className="my-10">
{listContainer}
</div>
</section>
);
};
export default Home;