Last active
August 10, 2021 17:43
-
-
Save kuipou/144758f71fff3263463ba89fc70e72d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { gql, useQuery } from '@apollo/client'; | |
const GET_SHOP_NAME = gql` | |
{ | |
products(first: 10) { | |
edges { | |
node { | |
id | |
title | |
bodyHtml | |
onlineStoreUrl | |
featuredImage { | |
src | |
altText | |
} | |
vendor | |
} | |
} | |
} | |
} | |
`; | |
export default function Orders() { | |
const { loading, error, data } = useQuery(GET_SHOP_NAME); | |
if (loading) return <div>Loading...</div>; | |
if (error) return <div>{error.message}</div> | |
console.log(`helo this the ` + data); | |
console.table(data, error, loading); | |
console.log(data.products.edges); | |
return ( | |
<div>Data was loaded look at log <br /> | |
{JSON.stringify(data.products.edges.[0].node)} | |
</div> | |
); | |
} | |
/* | |
query ListOrder{ | |
orders(first: 25, query: "fulfillment_status:unshipped", reverse: true) { | |
edges { | |
node { | |
id | |
totalPriceSet { | |
shopMoney { | |
amount | |
} | |
} | |
customer { | |
id | |
displayName | |
} | |
lineItems(first:50) { | |
edges { | |
cursor | |
node { | |
id | |
} | |
} | |
pageInfo { | |
hasNextPage | |
hasPreviousPage | |
} | |
} | |
} | |
} | |
} | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment