fix: исправлен плеер для фильмов

This commit is contained in:
Foxix
2025-02-09 21:22:57 +02:00
parent 660d4ad6dc
commit 37764dce4d
14 changed files with 553 additions and 12 deletions

View File

@@ -0,0 +1,45 @@
import { NextResponse } from 'next/server';
import { headers } from 'next/headers';
export async function GET(
request: Request,
{ params }: { params: { id: string } }
) {
try {
const headersList = headers();
const response = await fetch(
`https://neomovies-api.vercel.app/movies/${params.id}/external-ids`,
{
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
}
);
const data = await response.json();
// Создаем новый Response с нужными заголовками
return new NextResponse(JSON.stringify(data), {
status: 200,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type, Authorization'
}
});
} catch (error) {
console.error('Error fetching external IDs:', error);
return new NextResponse(
JSON.stringify({ error: 'Failed to fetch external IDs' }),
{
status: 500,
headers: {
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*'
}
}
);
}
}