deckhearth/pages/api/collections.js
Randall Stillwell bb60b4f6b0 Enhanced card detail page with real data and functionality
- Updated card detail page to fetch real data from API
- Added ownership tracking with quantity management
- Added favorite system for cards
- Added collection and deck management functionality
- Created API endpoints for ownership, favorites, collections, and decks
- Added database columns for quantity and favorited status
- Shows current collections and decks the card belongs to
- Added proper error handling and loading states
- Integrated with real card data from database
- Added purchase links to TCGPlayer and eBay
2025-07-24 15:03:09 -05:00

23 lines
No EOL
802 B
JavaScript

import { sql } from '@vercel/postgres';
export default async function handler(req, res) {
if (req.method !== 'GET') {
return res.status(405).json({ error: 'Method not allowed' });
}
try {
// For now, return mock collections until we implement user authentication
const mockCollections = [
{ id: 1, name: 'My MTG Collection', game: 'MTG' },
{ id: 2, name: 'Pokemon Favorites', game: 'Pokemon' },
{ id: 3, name: 'Lorcana Disney', game: 'Lorcana' },
{ id: 4, name: 'Rare Cards', game: 'MTG' },
{ id: 5, name: 'Holographic Collection', game: 'Pokemon' }
];
res.status(200).json(mockCollections);
} catch (error) {
console.error('Error fetching collections:', error);
res.status(500).json({ error: 'Failed to fetch collections' });
}
}