Spaces:
Sleeping
Sleeping
yassinekolsi
Fix Next.js 16 build: disable cacheComponents, add force-dynamic to all API routes and pages with server fetches
a3ea1a9
| import { NextResponse } from 'next/server'; | |
| import { getStats } from '@/lib/api'; | |
| export const dynamic = 'force-dynamic'; | |
| export async function GET() { | |
| try { | |
| const data = await getStats(); | |
| return NextResponse.json(data); | |
| } catch (err) { | |
| return NextResponse.json({ error: `Failed to fetch stats: ${err}` }, { status: 500 }); | |
| } | |
| } | |