Add missing null check in get clip.

This commit is contained in:
Ted Schaefer 2024-05-21 22:29:59 -07:00
parent cfa3e0ab7f
commit 3897c87a4d

View File

@ -9,6 +9,16 @@ export async function GET(req: NextRequest) {
try {
const url = new URL(req.url);
const clipId = url.searchParams.get('id');
if (clipId == null) {
return new NextResponse(JSON.stringify({ error: 'Missing parameter id' }), {
status: 400,
headers: {
'Content-Type': 'application/json',
...corsHeaders
}
});
}
const audioInfo = await (await sunoApi).getClip(clipId);
return new NextResponse(JSON.stringify(audioInfo), {