Poprawa graphFn === IDM_HOTSPOTS_GQL

This commit is contained in:
2025-10-15 11:07:17 +02:00
parent ad3e6a88e9
commit 3cbfc6253a
2 changed files with 322 additions and 1 deletions

View File

@@ -452,7 +452,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?.hotspots?.products : data?.data?.products?.products;
if(!products) throw new Error(idmHotspotTextObject["Nie znaleziono produktów"]);
console.log(data);