api call cleanup

This commit is contained in:
2026-03-27 20:54:28 +01:00
parent cb5246610d
commit 6f8f8ac03d
5 changed files with 21 additions and 21 deletions
+17 -1
View File
@@ -1,4 +1,4 @@
const API_BASE = 'http://192.168.178.41:3000'; // Backend URL
const API_BASE = 'http://192.168.178.41:3000';
export async function fetchCards() {
const response = await fetch(`${API_BASE}/exportCards`);
@@ -11,4 +11,20 @@ export async function fetchCardImage(cardId) {
if (!response.ok) throw new Error('Failed to fetch card image');
const data = await response.json();
return data.image;
}
export async function updateCardAmount(cardId, setId, rarityId, amount) {
const response = await fetch(`${API_BASE}/collection/amount`, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
card_id: cardId,
set_id: setId,
rarity_id: rarityId,
amount_owned: amount
})
});
if (!response.ok) throw new Error('Failed to update amount');
return await response.json();
}