import { SingleProductResponse } from "@/components/catalog/type"; import { GET_PRODUCT_SWATCH_REVIEW } from "@/graphql"; import { cachedProductRequest } from "@/utils/hooks/useCache"; export async function getProductWithSwatchAndReview(urlKey: string) { try { const {data:dataById} = await cachedProductRequest( // urlKey, GET_PRODUCT_SWATCH_REVIEW, { urlKey: urlKey } ); return dataById?.product || null; } catch (error) { if (error instanceof Error) { console.error("Error fetching product:", { message: error.message, urlKey, graphQLErrors: (error as unknown as Record) .graphQLErrors, }); } return null; } }