Files
YuGiOh-Database-Frontend/src/services/api.jsx
T
2026-03-27 19:57:29 +01:00

14 lines
475 B
React

const API_BASE = '/api'; // Backend URL
export async function fetchCards() {
const response = await fetch(`${API_BASE}/exportCards`);
if (!response.ok) throw new Error('Failed to fetch cards');
return await response.json();
}
export async function fetchCardImage(cardId) {
const response = await fetch(`${API_BASE}/cardImage/${cardId}`);
if (!response.ok) throw new Error('Failed to fetch card image');
const data = await response.json();
return data.image;
}