export const fetchProductManagementSolr = async () => { try { const queryParams = new URLSearchParams({q: 'type_value_s:bundling'}) const response = await fetch(`/solr/product_category_management/query?q=*:*&q.op=OR&sort=sequence_i asc&indent=true`); // console.log("response", response) if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); // console.log("data",data) const dataManagement = await map(data.response.docs); // console.log("dataManagement",dataManagement) return dataManagement; } catch (error) { console.error("Error fetching promotion data:", error); return []; } }; const map = async (promotions) => { const result = []; for (const promotion of promotions) { const data = { id: promotion.id, category_id: promotion.category_id_i, name: promotion.name_s, sequence: promotion.sequence_i, image: promotion.image_s, category_id2: JSON.parse(promotion.category_id2_s), }; result.push(data); } return result; };