Desc:
- Perubahan pengambilan data dari API ke Function use server
No issue
This commit is contained in:
2023-10-18 16:09:32 +08:00
parent 5f430786b4
commit 2a97165d1f
46 changed files with 398 additions and 345 deletions

View File

@@ -1,24 +0,0 @@
import { myConsole } from "@/app/fun/my_console";
import prisma from "@/app/lib/prisma";
import { NextResponse } from "next/server";
export async function POST(req: Request) {
if (req.method === "POST") {
const body = await req.json();
// myConsole(body);
const data = await prisma.katalog.create({
data: {
profileId: body.profileId,
namaBisnis: body.namaBisnis,
alamatKantor: body.alamatKantor,
tlpn: body.tlpn,
deskripssi: body.deskripssi,
masterBidangBisnisId: body.masterBidangBisnisId,
},
});
return NextResponse.json({ status: 201, success: true });
}
return NextResponse.json({ success: false });
}

View File

@@ -1,25 +0,0 @@
import { myConsole } from "@/app/fun/my_console";
import prisma from "@/app/lib/prisma";
import { NextResponse } from "next/server";
export async function POST(req: Request) {
if (req.method === "POST") {
const body = await req.json();
// myConsole(body);
const data = await prisma.profile.create({
data: {
userId: body.userId,
name: body.name,
email: body.email,
alamat: body.alamat,
jenisKelamin: body.jenisKelamin,
},
});
if (data) return NextResponse.json({ status: 201 });
return NextResponse.json({ success: true });
}
return NextResponse.json({ success: false });
}

View File

@@ -1,33 +0,0 @@
import { myConsole } from "@/app/fun/my_console";
import prisma from "@/app/lib/prisma";
import { NextResponse } from "next/server";
export async function POST(req: Request) {
if (req.method === "POST") {
const body = await req.json();
// myConsole(body);
const data = await prisma.profile.update({
where: {
id: body.id
},
data: {
name: body.name,
email: body.email,
alamat: body.alamat,
jenisKelamin: body.jenisKelamin
}
})
if(data) {
return NextResponse.json({status: 200})
} else {
return new Response("Error",{ status :401 });
}
return NextResponse.json({ success: true });
}
return NextResponse.json({ success: false });
}