add name volume and update error handling

This commit is contained in:
2025-08-17 15:52:52 +01:00
parent 65f478e675
commit 7aac334b55
4 changed files with 8 additions and 7 deletions

View File

@@ -72,6 +72,6 @@ export async function GET(req: NextRequest) {
{ status: 200 }
);
}
return Response.json({ error: 'Failed to fetch cards' }, { status: 500 });
return Response.json({ error: `Failed to fetch cards: ${err}` }, { status: 500 });
}
}

View File

@@ -96,7 +96,7 @@ export default function Page() {
setError(null);
try {
const res = await fetch('/api/magikarp?pageSize=250&refresh=1', { cache: 'no-store' });
if (!res.ok) throw new Error('Failed to refresh');
if (!res.ok) throw new Error(`Failed to refresh: ${res.body}`);
const json = await res.json();
const list: TcgCard[] = json.data || [];
list.sort((a, b) => {