🔧 Fixed Cards Page API Response Format
- Updated /api/cards/search to return expected format with success, cards, pagination, and filters - This fixes the empty cards page when clicking 'Add Cards' - Removed debug console logs since TCG tags and CollaboratorFacepile are working - Cards page should now display the sample cards properly
This commit is contained in:
parent
e41d0b986e
commit
d10b70da16
3 changed files with 18 additions and 15 deletions
|
|
@ -73,15 +73,7 @@ export default function CollaboratorFacepile({ collectionId, creatorEmail }) {
|
|||
}
|
||||
};
|
||||
|
||||
console.log('CollaboratorFacepile render:', {
|
||||
collectionId,
|
||||
creatorEmail,
|
||||
collaborators: collaborators.length,
|
||||
allUsers: allUsers.length,
|
||||
loading,
|
||||
collaboratorsData: collaborators,
|
||||
allUsersData: allUsers
|
||||
});
|
||||
// Debug: Log removed - functionality working
|
||||
|
||||
return (
|
||||
<div className="flex items-center space-x-2">
|
||||
|
|
|
|||
|
|
@ -39,7 +39,21 @@ export default async function handler(req, res) {
|
|||
`;
|
||||
}
|
||||
|
||||
res.status(200).json(result.rows);
|
||||
res.status(200).json({
|
||||
success: true,
|
||||
cards: result.rows,
|
||||
pagination: {
|
||||
page: 1,
|
||||
limit: parseInt(limit),
|
||||
total: result.rows.length,
|
||||
pages: 1
|
||||
},
|
||||
filters: {
|
||||
games: [...new Set(result.rows.map(card => card.game).filter(Boolean))],
|
||||
rarities: [...new Set(result.rows.map(card => card.rarity).filter(Boolean))],
|
||||
sets: [...new Set(result.rows.map(card => card.set_name).filter(Boolean))]
|
||||
}
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error searching cards:', error);
|
||||
|
|
|
|||
|
|
@ -299,10 +299,7 @@ export default function CollectionView() {
|
|||
return acc;
|
||||
}, {});
|
||||
|
||||
// Debug: Log the grouped cards to see what games we have
|
||||
console.log('Grouped cards:', groupedCards);
|
||||
console.log('Available games:', Object.keys(groupedCards));
|
||||
console.log('Sample card data:', cards[0]); // Check what fields the card actually has
|
||||
// Debug: Log removed - functionality working
|
||||
|
||||
// Get game display names and counts - make it more flexible
|
||||
const gameStats = {};
|
||||
|
|
@ -399,7 +396,7 @@ export default function CollectionView() {
|
|||
|
||||
{/* Creator and Stats */}
|
||||
<div className="flex items-center space-x-6 text-sm" style={{ color: 'var(--text-secondary)' }}>
|
||||
{console.log('Collection data for facepile:', { id, creator_email: collection.creator_email, collection })}
|
||||
|
||||
{collection.creator_email ? (
|
||||
<CollaboratorFacepile
|
||||
collectionId={id}
|
||||
|
|
|
|||
Loading…
Reference in a new issue