diff --git a/sklad/2funkcje.js b/sklad/2funkcje.js index 8b0ad12..1636bb5 100644 --- a/sklad/2funkcje.js +++ b/sklad/2funkcje.js @@ -245,7 +245,7 @@ async function idmGetHotspotData(query, graphFn){ body: graphFn ? graphFn(query) : IDM_PRODUCTS_GQL(query) }); const data = await res.json(); - const products = data[graphFn === IDM_HOTSPOTS_GQL ? "hotspots" : "data"]?.products?.products; + const products = graphFn === IDM_HOTSPOTS_GQL ? data?.data?.hotspots?.products : data?.data?.products?.products; if(!products) throw new Error(idmHotspotTextObject["Nie znaleziono produktów"]); console.log(data);