aboutsummaryrefslogtreecommitdiffstats
path: root/pages/index.js
blob: 9974583396aa40c7aa7783b8b12102de24701b67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import Avatar from "../components/Avatar"

export default function Avs(props) {
  return (
    <>
      <h1>Avatars</h1>
      {props.avs.map(data => <Avatar data={data} key={data.id} />)}
    </>
  )
}

export const getStaticProps = async () => {
  const res = await fetch(`http://localhost:3000/api/avatars`);
  const avs = await res.json();
  return {
    props: {
      avs
    }
  }
}