Some API changes in Song. Added '.trim()' for better string processing
This commit is contained in:
1 parent
61f1eb5a2c
commit
66c9dc28fc
5 files changed
+123
-42
No files matched your search
@@ -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(
|
||||
|
||||
Reference in new issue
Block a user