This commit is contained in:
2026-04-25 12:38:32 +02:00
commit 39c900a41b
25 changed files with 4226 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
import axios from "axios";
import { useAuthStore } from "../store/authStore";
const API_URL = "/api/v1/wishlist";
export async function toggleNoticeStatus(noticeId) {
const { token } = useAuthStore.getState();
const headers = token ? { Authorization: `Bearer ${token}` } : {};
try {
const response = await axios.post(
`${API_URL}/toggle/${noticeId}`,
{},
{ headers: headers }
);
return response.data;
} catch (error) {
console.error("Error toggling wishlist item:", error);
throw error;
}
}
export async function getWishlist() {
const { token } = useAuthStore.getState();
const headers = token ? { Authorization: `Bearer ${token}` } : {};
try {
const response = await axios.get(`${API_URL}/`, { headers: headers });
return response.data;
} catch (error) {
console.error("Error fetching wishlist:", error);
throw error;
}
}