21 lines
700 B
TypeScript
21 lines
700 B
TypeScript
import { prisma } from "@/module/_global";
|
|
import { NextResponse } from "next/server";
|
|
|
|
|
|
// GET ONE BANNER
|
|
export async function GET(request: Request, context: { params: { id: string } }) {
|
|
try {
|
|
const { id } = context.params;
|
|
|
|
const data = await prisma.bannerImage.findUnique({
|
|
where: {
|
|
id: String(id)
|
|
}
|
|
})
|
|
|
|
return NextResponse.json({ success: true, message: "Berhasil mendapatkan banner", data }, { status: 200 });
|
|
} catch (error) {
|
|
console.error(error);
|
|
return NextResponse.json({ success: false, message: "Gagal mendapatkan banner, coba lagi nanti (error: 500)", reason: (error as Error).message, }, { status: 500 });
|
|
}
|
|
} |