Last active
December 20, 2020 23:57
-
-
Save LuigiClaudio/97ceec8c07c4bfd5a9458b4f5ce53f21 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 { graphql, useStaticQuery } from 'gatsby'; | |
const usePrintfulProducts = () => { | |
const { allStoreProducts } = useStaticQuery( | |
graphql` | |
query usePrintfulProducts { | |
allStoreProducts(filter: { productId: { ne: null } }) { | |
nodes { | |
productId | |
currency | |
printfulProduct { | |
name | |
id | |
slug | |
thumbnail_url | |
variants { | |
retail_price | |
name | |
style | |
sync_product_id | |
id | |
sku | |
product { | |
variant_id | |
name | |
} | |
variantImage { | |
url | |
} | |
} | |
} | |
} | |
} | |
} | |
`, | |
); | |
const products = allStoreProducts.nodes.map((item) => { | |
return item; | |
}); | |
return { products }; | |
}; | |
export default usePrintfulProducts; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment