aboutsummaryrefslogtreecommitdiffstats
path: root/pages/index.js
diff options
context:
space:
mode:
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
+ }
+ }
+}