import { fetchData } from '@/lib/data-service'; export const fetchProductData = async (url: string, authToken: string) => { try { return await fetchData(url, { headers: { Authorization: `Bearer ${authToken}` }, credentials: "include", }); } catch (error) { console.error("Error fetching product data:", error); throw error; } }; export const saveProductData = async ( url: string, data: any, authToken: string, method: "POST" | "PUT" = "POST" ) => { try { return await fetchData(url, { method, headers: { Authorization: `Bearer ${authToken}`, "Content-Type": "application/json", }, credentials: "include", body: JSON.stringify(data), }); } catch (error) { console.error("Error saving product data:", error); throw error; } }; export const deleteProductData = async (url: string, authToken: string) => { try { return await fetchData(url, { method: "DELETE", headers: { Authorization: `Bearer ${authToken}`, "Content-Type": "application/json", }, credentials: "include", }); } catch (error) { console.error("Error deleting product data:", error); throw error; } };