Fix Lorcana API search syntax - use correct endpoints and search parameters
This commit is contained in:
parent
0a09b333c4
commit
dbb0353def
2 changed files with 7 additions and 5 deletions
|
|
@ -15,9 +15,10 @@ export async function GET(request) {
|
||||||
if (api === 'lorcana') {
|
if (api === 'lorcana') {
|
||||||
// Lorcana API - using correct endpoint from docs
|
// Lorcana API - using correct endpoint from docs
|
||||||
if (search) {
|
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 {
|
} else {
|
||||||
url = `https://api.lorcana-api.com/cards?limit=${limit}`;
|
url = `https://api.lorcana-api.com/cards/fetch?pagesize=${limit}`;
|
||||||
}
|
}
|
||||||
headers = {
|
headers = {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
|
|
||||||
|
|
@ -331,7 +331,8 @@ export const lorcanaService = {
|
||||||
|
|
||||||
// Fallback to direct APIs
|
// Fallback to direct APIs
|
||||||
try {
|
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) {
|
if (response.ok) {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
@ -472,7 +473,7 @@ export const lorcanaService = {
|
||||||
|
|
||||||
// Fallback to direct Lorcana API
|
// Fallback to direct Lorcana API
|
||||||
try {
|
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) {
|
if (response.ok) {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
@ -619,7 +620,7 @@ export const lorcanaService = {
|
||||||
|
|
||||||
// Fallback to direct Lorcana API
|
// Fallback to direct Lorcana API
|
||||||
try {
|
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) {
|
if (response.ok) {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue