From e81e6b574364591bbd8cd3126f9d6e4962d4eb0b Mon Sep 17 00:00:00 2001 From: Mayo Date: Fri, 31 Jul 2026 16:00:40 +0200 Subject: [PATCH] Added Status takes from helpermethods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Die Helfermethoden (/lib/db/*) bieten Statuscodes, welche hier übernommen wurden. --- app/api/songbooks/route.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/api/songbooks/route.ts b/app/api/songbooks/route.ts index 6420574..7dcaf7c 100644 --- a/app/api/songbooks/route.ts +++ b/app/api/songbooks/route.ts @@ -27,20 +27,20 @@ export async function GET(request: Request) { const res = await searchSongBooksByTitle(query); // You can enter a limit if (!res.success) { - return NextResponse.json({ message: res.error }, { status: 500 }); + return NextResponse.json({ message: res.error }, { status: res.status }); } - return NextResponse.json(res.songBooks, { status: 200 }); + return NextResponse.json(res.songBooks, { status: res.status }; } // Ansonsten alle Bücher abrufen const res = await getSongBooks(); if (!res.success) { - return NextResponse.json({ message: res.error }, { status: 500 }); + return NextResponse.json({ message: res.error }, { status: res.status }); } - return NextResponse.json(res.songBooks, { status: 200 }); + return NextResponse.json(res.songBooks, { status: res.status }); } catch (error) { console.error("GET /api/songbooks error:", error); @@ -123,11 +123,11 @@ export async function POST(request: Request) { if (!res.success) { return NextResponse.json( { message: res.error }, - { status: res.status | 500} // ALERT-TODO Implement!!! + { status: res.status } ); } - return NextResponse.json(res, { status: 201 }); + return NextResponse.json(res, { status: res.status }); } catch (error) { console.error("POST /api/songbooks error:", error);