2021-12-13 17:12:51 -03:00
|
|
|
import { GetStaticProps } from 'next'
|
|
|
|
|
|
2021-12-12 23:45:41 -03:00
|
|
|
import { Home } from '../components/Home'
|
2021-12-13 17:12:51 -03:00
|
|
|
import { useFetchData } from '../hooks/useFetchData'
|
|
|
|
|
import { fetchData } from '../services/fetchData'
|
|
|
|
|
import type { Data } from '../types/Data'
|
|
|
|
|
|
|
|
|
|
type HomePageProps = {
|
|
|
|
|
data: Data
|
|
|
|
|
}
|
2021-12-11 01:48:15 -03:00
|
|
|
|
2021-12-13 17:12:51 -03:00
|
|
|
export default function HomePage({ data }: HomePageProps) {
|
|
|
|
|
useFetchData(data)
|
2021-12-12 23:45:41 -03:00
|
|
|
return <Home />
|
2021-12-10 20:54:28 -03:00
|
|
|
}
|
2021-12-13 17:12:51 -03:00
|
|
|
|
|
|
|
|
export const getStaticProps: GetStaticProps = async () => {
|
|
|
|
|
const data = await fetchData()
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
props: { data },
|
|
|
|
|
revalidate: 1
|
|
|
|
|
}
|
|
|
|
|
}
|