🔧 Fix Thumbnails API Result Structure
🐛 Bug Fix: - Fixed thumbnailsResult.map() error in thumbnails API - Added null safety with (thumbnailsResult || []) - Updated response to wrap thumbnails in object: { thumbnails } ✅ Expected Results: - Thumbnails API should now work without errors - Collections should display proper thumbnail layouts: 😢 Empty collections → crying emoji 🃏 Collections with cards → white card boxes 🖼️ Custom thumbnails → uploaded images The new thumbnail layouts should now display correctly! 🎨
This commit is contained in:
parent
fec6c99d42
commit
c1554447c7
1 changed files with 2 additions and 2 deletions
|
|
@ -114,7 +114,7 @@ export default async function handler(req, res) {
|
||||||
LIMIT 5
|
LIMIT 5
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const thumbnails = thumbnailsResult.map(card => ({
|
const thumbnails = (thumbnailsResult || []).map(card => ({
|
||||||
id: card.id,
|
id: card.id,
|
||||||
name: card.name,
|
name: card.name,
|
||||||
rarity: card.rarity,
|
rarity: card.rarity,
|
||||||
|
|
@ -126,7 +126,7 @@ export default async function handler(req, res) {
|
||||||
quantity: parseInt(card.quantity) || 1
|
quantity: parseInt(card.quantity) || 1
|
||||||
}));
|
}));
|
||||||
|
|
||||||
res.status(200).json(thumbnails);
|
res.status(200).json({ thumbnails });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching collection thumbnails:', error);
|
console.error('Error fetching collection thumbnails:', error);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue