Quellcode durchsuchen

icon

cart-api-guide
azri vor 4 Tagen
Ursprung
Commit
2ff901dc43
4 geänderte Dateien mit 15 neuen und 13 gelöschten Zeilen
  1. BIN
      public/favicon.ico
  2. BIN
      public/favicon_bak.ico
  3. 1
    1
      public/index.html
  4. 14
    12
      src/services/ProductService.js

BIN
public/favicon.ico Datei anzeigen


BIN
public/favicon_bak.ico Datei anzeigen


+ 1
- 1
public/index.html Datei anzeigen

@@ -24,7 +24,7 @@
24 24
       work correctly both with client-side routing and a non-root public URL.
25 25
       Learn how to configure a non-root public URL by running `npm run build`.
26 26
     -->
27
-    <title>React App</title>
27
+    <title>AMBER</title>
28 28
   </head>
29 29
   <body>
30 30
     <noscript>You need to enable JavaScript to run this app.</noscript>

+ 14
- 12
src/services/ProductService.js Datei anzeigen

@@ -5,26 +5,28 @@ import { API_URL, REACT_APP_API_KEY, REACT_APP_API_SECRET, REACT_APP_ACCESS_TOKE
5 5
 const shopUrl = REACT_APP_SHOP_NAME;
6 6
 const accessToken = REACT_APP_ACCESS_TOKEN;
7 7
 
8
+const client = createStorefrontApiClient({
9
+  storeDomain: `https://${shopUrl}/api/2024-10/graphql.json`,
10
+  apiVersion: '2024-10',
11
+  publicAccessToken: accessToken,
12
+});
8 13
 
9
-const getProducts = async () => {
10
-
11
-  console.log(shopUrl)
12
-  console.log(accessToken)
13
-  console.log(createStorefrontApiClient)
14 14
 
15
-  const client = createStorefrontApiClient({
16
-    storeDomain: `https://${shopUrl}/api/2024-10/graphql.json`,
17
-    apiVersion: '2024-10',
18
-    publicAccessToken: accessToken,
19
-  });
15
+const getProducts = async () => {
20 16
 
21 17
   const productQuery = `
22 18
     {
23 19
       products(first: 99) {
24 20
         nodes {
25
-          id
21
+          media(first: 4) {
22
+            nodes {
23
+              previewImage {
24
+                url
25
+              }
26
+            }
27
+          }
26 28
           title
27
-          totalInventory
29
+          tags
28 30
         }
29 31
       }
30 32
     }

Laden…
Abbrechen
Speichern