We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4169523 commit 3c7f504Copy full SHA for 3c7f504
marmite/pages/index.js
@@ -1,7 +1,19 @@
1
-export default function Recipes() {
2
- return (
3
- <div className="recipe-list">
4
- Recipe List
5
- </div>
6
- )
7
-}
+import { createClient } from "contentful";
+
+export async function getStaticProps() {
+ const client = createClient({
+ space: process.env.CONTENTFUL_SPACE_ID,
+ accessToken: process.env.CONTENTFUL_DELIVERY_API,
+ });
8
+ const res = await client.getEntries({ content_type: "recipe" });
9
+ return {
10
+ props: {
11
+ recipes: res.items,
12
+ },
13
+ };
14
+}
15
16
+export default function Recipes({ recipes }) {
17
+ console.log(recipes);
18
+ return <div className="recipe-list">Recipe List</div>;
19
0 commit comments