From c1554447c7c83b05ec7b225aabe75ca94f417cb6 Mon Sep 17 00:00:00 2001 From: Randall Stillwell Date: Sun, 27 Jul 2025 14:32:09 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fix=20Thumbnails=20API=20Result?= =?UTF-8?q?=20Structure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 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! 🎨 --- pages/api/collections/[identifier]/thumbnails.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/api/collections/[identifier]/thumbnails.js b/pages/api/collections/[identifier]/thumbnails.js index a86c730..9947c34 100644 --- a/pages/api/collections/[identifier]/thumbnails.js +++ b/pages/api/collections/[identifier]/thumbnails.js @@ -114,7 +114,7 @@ export default async function handler(req, res) { LIMIT 5 `; - const thumbnails = thumbnailsResult.map(card => ({ + const thumbnails = (thumbnailsResult || []).map(card => ({ id: card.id, name: card.name, rarity: card.rarity, @@ -126,7 +126,7 @@ export default async function handler(req, res) { quantity: parseInt(card.quantity) || 1 })); - res.status(200).json(thumbnails); + res.status(200).json({ thumbnails }); } catch (error) { console.error('Error fetching collection thumbnails:', error);