change and sync wishlist with api
This commit is contained in:
29
ArtisanConnect/api/wishlist.jsx
Normal file
29
ArtisanConnect/api/wishlist.jsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import axios from "axios";
|
||||
// import FormData from 'form-data'
|
||||
|
||||
const API_URL = "https://testowe.zikor.pl/api/v1/wishlist";
|
||||
|
||||
export async function toggleNoticeStatus(noticeId) {
|
||||
try {
|
||||
const response = await axios.post(`${API_URL}/toggle/${noticeId}`, null, {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("Error toggling wishlist item:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function getWishlist() {
|
||||
try {
|
||||
const response = await axios.get(`${API_URL}/`);
|
||||
console.log("Wishlist response:", response.data);
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("Error fetching wishlist:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user