aboutsummaryrefslogtreecommitdiffstats
path: root/pages/index.js
diff options
context:
space:
mode:
authorMaksymilian Jopek <maks@jopek.eu>2023-03-28 19:26:30 +0200
committerMaksymilian Jopek <maks@jopek.eu>2023-03-28 19:26:30 +0200
commitc3c90d575182d64b0e679e8da81a6d4f3559cf1f (patch)
treee1ad938d658e6c80c1392bca86d0755f47064882 /pages/index.js
downloadnext-list-app-master.tar.gz
next-list-app-master.tar.zst
next-list-app-master.zip
Working appHEADmaster
Diffstat (limited to 'pages/index.js')
-rw-r--r--pages/index.js20
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
+ }
+ }
+}