import axios from 'axios' import { createStorefrontApiClient } from '@shopify/storefront-api-client'; import { API_URL, REACT_APP_API_KEY, REACT_APP_API_SECRET, REACT_APP_ACCESS_TOKEN, REACT_APP_SHOP_NAME } from '../utils/httpCommon' const shopUrl = REACT_APP_SHOP_NAME; const accessToken = REACT_APP_ACCESS_TOKEN; const client = createStorefrontApiClient({ storeDomain: `https://${shopUrl}/api/2024-10/graphql.json`, apiVersion: '2024-10', publicAccessToken: accessToken, }); const getProducts = async () => { const productQuery = ` { products(first: 99) { nodes { media(first: 4) { nodes { previewImage { url } } } title tags } } } `; const { data, errors, extensions } = await client.request(productQuery, { variables: { handle: 'sample-product', }, }); console.log(data) return } const ProductService = { getProducts } export default ProductService