Some API changes in Song. Added '.trim()' for better string processing

This commit is contained in:
rudi committed 2026-08-03 08:16:55 +02:00
1 parent 61f1eb5a2c
commit 66c9dc28fc
5 files changed
+123 -42

No files matched your search

+9 -8
View File
@@ -1,15 +1,16 @@
import { NextResponse } from "next/server";
import { getSongInfos } from "@/lib/db/managing";
import { getSongById, updateSong, deleteSong } from "@/lib/db/song";
export async function GET(
request: Request,
{ params }: { params: Promise<{ id: string }> }
) {
export async function GET(request: Request, { params }) {
try {
const { id } = await params;
const songInfos = await getSongInfos(id);
return NextResponse.json(songInfos || []);
const res = await getSongById(id);
if (!res.success) {
return NextResponse.json({ message: res.error }, { status: res.status });
}
return NextResponse.json(res.song, { status: res.status });
} catch (error) {
console.error("API Error:", error);
return NextResponse.json(