24 lines
509 B
TypeScript
24 lines
509 B
TypeScript
import React from "react";
|
|
import { GetStaticProps } from "next";
|
|
import { Link, Links } from "components/Links";
|
|
|
|
export const getStaticProps: GetStaticProps<Props> = async () => {
|
|
const res = await fetch(`http://${process.env.SERVER_URL}/links`);
|
|
const links = await res.json();
|
|
|
|
return {
|
|
props: { links },
|
|
revalidate: 60,
|
|
};
|
|
};
|
|
|
|
interface Props {
|
|
links: Link[];
|
|
}
|
|
|
|
const Home: React.FC<Props> = ({ links }) => {
|
|
return <Links links={links} logClicks={true} />;
|
|
};
|
|
|
|
export default Home;
|