- 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
23 lines
No EOL
759 B
JavaScript
23 lines
No EOL
759 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 decks until we implement user authentication
|
|
const mockDecks = [
|
|
{ id: 1, name: 'MTG Control Deck', game: 'MTG' },
|
|
{ id: 2, name: 'Pokemon Aggro', game: 'Pokemon' },
|
|
{ id: 3, name: 'Lorcana Midrange', game: 'Lorcana' },
|
|
{ id: 4, name: 'MTG Combo', game: 'MTG' },
|
|
{ id: 5, name: 'Pokemon Stall', game: 'Pokemon' }
|
|
];
|
|
|
|
res.status(200).json(mockDecks);
|
|
} catch (error) {
|
|
console.error('Error fetching decks:', error);
|
|
res.status(500).json({ error: 'Failed to fetch decks' });
|
|
}
|
|
}
|