diff --git a/api/proxy/lorcana.js b/api/proxy/lorcana.js index 176cc58..91c5677 100644 --- a/api/proxy/lorcana.js +++ b/api/proxy/lorcana.js @@ -15,9 +15,10 @@ export async function GET(request) { if (api === 'lorcana') { // Lorcana API - using correct endpoint from docs if (search) { - url = `https://api.lorcana-api.com/cards?search=${encodeURIComponent(search)}`; + // Use the correct search parameter format for Lorcana API + url = `https://api.lorcana-api.com/cards/fetch?search=name~${encodeURIComponent(search)}`; } else { - url = `https://api.lorcana-api.com/cards?limit=${limit}`; + url = `https://api.lorcana-api.com/cards/fetch?pagesize=${limit}`; } headers = { 'Accept': 'application/json', diff --git a/src/services/cardDataSources.ts b/src/services/cardDataSources.ts index 40c5123..f8024ad 100644 --- a/src/services/cardDataSources.ts +++ b/src/services/cardDataSources.ts @@ -331,7 +331,8 @@ export const lorcanaService = { // Fallback to direct APIs try { - const response = await fetch(`${LORCANA_API_BASE_URL}/cards?search=${encodeURIComponent(query)}`); + // Use correct search syntax for Lorcana API + const response = await fetch(`${LORCANA_API_BASE_URL}/cards/fetch?search=name~${encodeURIComponent(query)}`); if (response.ok) { const data = await response.json(); @@ -472,7 +473,7 @@ export const lorcanaService = { // Fallback to direct Lorcana API try { - const response = await fetch(`${LORCANA_API_BASE_URL}/cards?search=${encodeURIComponent(name)}`); + const response = await fetch(`${LORCANA_API_BASE_URL}/cards/fetch?search=name~${encodeURIComponent(name)}`); if (response.ok) { const data = await response.json(); @@ -619,7 +620,7 @@ export const lorcanaService = { // Fallback to direct Lorcana API try { - const response = await fetch(`${LORCANA_API_BASE_URL}/cards?limit=${count}`); + const response = await fetch(`${LORCANA_API_BASE_URL}/cards/fetch?pagesize=${count}`); if (response.ok) { const data = await response.json();