add name volume and update error handling
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
{
|
||||
"reverseHolofoil": {
|
||||
"dp7-65": true
|
||||
}
|
||||
"reverseHolofoil": {}
|
||||
}
|
||||
@@ -20,6 +20,9 @@ services:
|
||||
# Select host port via APP_PORT env var; default 3000
|
||||
- "${APP_PORT:-3000}:3000"
|
||||
volumes:
|
||||
# Persist local cache JSON files
|
||||
- ./data:/app/data
|
||||
# Persist cache JSON files using a named volume
|
||||
- magikarp-data:/app/data
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
magikarp-data:
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user