diff options
| author | Maksymilian Jopek <maks@jopek.eu> | 2023-03-28 19:26:30 +0200 |
|---|---|---|
| committer | Maksymilian Jopek <maks@jopek.eu> | 2023-03-28 19:26:30 +0200 |
| commit | c3c90d575182d64b0e679e8da81a6d4f3559cf1f (patch) | |
| tree | e1ad938d658e6c80c1392bca86d0755f47064882 /pages/index.js | |
| download | next-list-app-master.tar.gz next-list-app-master.tar.zst next-list-app-master.zip | |
Diffstat (limited to 'pages/index.js')
| -rw-r--r-- | pages/index.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pages/index.js b/pages/index.js new file mode 100644 index 0000000..9974583 --- /dev/null +++ b/pages/index.js @@ -0,0 +1,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 + } + } +} |
