blob: 7b63aa4194b07bbe1d144bfe11d6b7ad1a414c45 (
plain) (
tree)
|
|
export const fetchAds = async () => {
const response = await fetch('http://localhost:5000/ads');
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
};
export const addAd = async (ad) => {
const response = await fetch('http://localhost:5000/ads', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(ad),
});
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
};
|