feat: affichage images produit dans la liste avec thumbnail et compteur
This commit is contained in:
@@ -31,6 +31,7 @@ interface ShopifyAPIProduct {
|
||||
body_html: string
|
||||
status: string
|
||||
variants: ShopifyVariant[]
|
||||
images: Array<{ src: string }>
|
||||
}
|
||||
|
||||
function toSyncProduct(p: ShopifyAPIProduct): ShopifyProductFull {
|
||||
@@ -43,6 +44,7 @@ function toSyncProduct(p: ShopifyAPIProduct): ShopifyProductFull {
|
||||
price: p.variants[0]?.price ?? '0.00',
|
||||
stock: p.variants[0]?.inventory_quantity ?? 0,
|
||||
status: p.status === 'active' ? 'active' : 'draft',
|
||||
images: (p.images ?? []).map(i => i.src),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +71,7 @@ async function fetchByStatus(status: 'active' | 'draft'): Promise<ShopifyProduct
|
||||
const all: ShopifyProductFull[] = []
|
||||
|
||||
let url: string | null =
|
||||
`${baseUrl}/products.json?limit=250&fields=id,title,handle,status,body_html,variants&status=${status}`
|
||||
`${baseUrl}/products.json?limit=250&fields=id,title,handle,status,body_html,variants,images&status=${status}`
|
||||
|
||||
while (url) {
|
||||
const res = await fetch(url, { headers })
|
||||
|
||||
Reference in New Issue
Block a user