- Add 'force-dynamic' export to API routes using cookies/searchParams - Add 'force-dynamic' export to page components using dynamic features - Create proper error pages without i18n complexity - Fix "Dynamic server usage" errors during static generation Routes now properly marked as dynamic will render at request time instead of failing during build-time static generation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
21 lines
No EOL
666 B
TypeScript
21 lines
No EOL
666 B
TypeScript
import { NextRequest, NextResponse } from 'next/server';
|
|
import { fetchFromApi } from '~/app/lib/api-utils';
|
|
|
|
// Force dynamic rendering because fetchFromApi uses cookies
|
|
export const dynamic = 'force-dynamic';
|
|
|
|
// GET handler for fetching raid groups
|
|
export async function GET(request: NextRequest) {
|
|
try {
|
|
// Fetch raid groups
|
|
const data = await fetchFromApi('/raids/groups');
|
|
|
|
return NextResponse.json(data);
|
|
} catch (error: any) {
|
|
console.error('Error fetching raid groups', error);
|
|
return NextResponse.json(
|
|
{ error: error.message || 'Failed to fetch raid groups' },
|
|
{ status: error.response?.status || 500 }
|
|
);
|
|
}
|
|
} |