|
@@ -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
|
}
|