const API_URL = 'http://localhost:5000'; // Replace with your actual API URL export const fetchAds = async () => { try { const response = await fetch(`${API_URL}/ads`); if (!response.ok) { throw new Error('Network response was not ok'); } return await response.json(); } catch (error) { console.error('Error fetching ads:', error); return []; } }; export const addAd = async (ad) => { try { const response = await fetch(`${API_URL}/ads`, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(ad), }); if (!response.ok) { throw new Error('Network response was not ok'); } return await response.json(); } catch (error) { console.error('Error adding ad:', error); } };