Jum'at, 30 May 2025 :
Yang Sudah Di Kerjakan * Tampilan UI Admin di menu inovasi * API Create, edit dan delete potensi * Tampilan UI Landing Page sudah sesuai di mobile Yang Lagi Dikerjakan: * Progress Tampilan UI Admin Di Menu lingkungan * Progress API Create, edit dan delete potensi Yang Akan Dikerjakan: * API Create, edit dan delete pengumuman * Tampilan UI Admin Di Menu Pendidikan
This commit is contained in:
@@ -13,9 +13,6 @@ type FormCreate = Prisma.BeritaGetPayload<{
|
||||
}>;
|
||||
async function beritaCreate(context: Context) {
|
||||
const body = context.body as FormCreate;
|
||||
console.log(body)
|
||||
|
||||
// console.log(body)
|
||||
|
||||
await prisma.berita.create({
|
||||
data: {
|
||||
|
||||
@@ -40,26 +40,20 @@ export default async function handler(
|
||||
}
|
||||
|
||||
// Ensure we're returning a proper Response object
|
||||
return new Response(JSON.stringify({
|
||||
return Response.json({
|
||||
success: true,
|
||||
message: "Success fetch berita by ID",
|
||||
data,
|
||||
}), {
|
||||
}, {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("Find by ID error:", e);
|
||||
return new Response(JSON.stringify({
|
||||
return Response.json({
|
||||
success: false,
|
||||
message: "Gagal mengambil berita: " + (e instanceof Error ? e.message : 'Unknown error'),
|
||||
}), {
|
||||
}, {
|
||||
status: 500,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ async function beritaUpdate(context: Context) {
|
||||
{ status: 200, headers: { 'Content-Type': 'application/json' } }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error updating berita:", error);
|
||||
console.error("Error updating berita:", error);
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
success: false,
|
||||
|
||||
Reference in New Issue
Block a user