blob: 7b63aa4194b07bbe1d144bfe11d6b7ad1a414c45 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
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();
};
|