2021-03-03 18:51:53 -05:00
|
|
|
import React from "react";
|
|
|
|
import { GetStaticProps } from "next";
|
2021-04-02 16:14:50 -04:00
|
|
|
import { Link, Links } from "components/Links";
|
2021-03-22 15:35:13 -04:00
|
|
|
|
2021-04-02 16:14:50 -04:00
|
|
|
export const getStaticProps: GetStaticProps<Props> = async () => {
|
2021-04-06 01:05:10 -04:00
|
|
|
const res = await fetch(`http://${process.env.SERVER_URL}/links`);
|
2021-04-03 21:01:00 -04:00
|
|
|
const links = await res.json();
|
2021-03-03 18:51:53 -05:00
|
|
|
|
|
|
|
return {
|
2021-04-02 16:14:50 -04:00
|
|
|
props: { links },
|
2021-04-03 21:01:00 -04:00
|
|
|
revalidate: 60,
|
2021-03-03 18:51:53 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-04-02 16:14:50 -04:00
|
|
|
interface Props {
|
|
|
|
links: Link[];
|
|
|
|
}
|
|
|
|
|
|
|
|
const Home: React.FC<Props> = ({ links }) => {
|
2021-04-05 11:00:14 -04:00
|
|
|
return <Links links={links} logClicks={true} />;
|
2021-03-03 18:51:53 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
export default Home;
|