Calling getStatus from home page

This commit is contained in:
Jamie Hewitt 2022-09-30 13:47:53 +03:00
parent e5efb50726
commit d67db95c42

View File

@ -1,9 +1,23 @@
import type { NextPage } from 'next'
import Head from 'next/head'
import Image from 'next/image'
import { ReactElement, useEffect, useState } from 'react'
import { Status } from '../@types'
import styles from '../styles/Home.module.css'
import { getData } from '../utils/getData'
export default function HomePage(): ReactElement {
const [statuses, setStatuses] = useState<Status[]>()
useEffect(() => {
async function getStatuses() {
const data = await getData()
data && setStatuses(data)
console.log('statuses', statuses)
}
getStatuses()
}, [])
const Home: NextPage = () => {
return (
<div className={styles.container}>
<Head>
@ -66,5 +80,3 @@ const Home: NextPage = () => {
</div>
)
}
export default Home