fix
Desc: - Perubahan minor No issue
This commit is contained in:
33
src/app/api/profile/edit/route.ts
Normal file
33
src/app/api/profile/edit/route.ts
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
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 });
|
||||||
|
}
|
||||||
9
src/app/dev/katalog/profile/edit/layout.tsx
Normal file
9
src/app/dev/katalog/profile/edit/layout.tsx
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import { EditProfileLayout } from "@/app_modules/katalog/profile";
|
||||||
|
|
||||||
|
export default function Layout({ children }: { children: any }) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<EditProfileLayout>{children}</EditProfileLayout>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
13
src/app/dev/katalog/profile/edit/page.tsx
Normal file
13
src/app/dev/katalog/profile/edit/page.tsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { getProfile } from "@/app_modules/katalog/profile";
|
||||||
|
import EditProfile from "@/app_modules/katalog/profile/edit/view";
|
||||||
|
|
||||||
|
export default async function Page() {
|
||||||
|
const data = await getProfile();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* {JSON.stringify(data)} */}
|
||||||
|
<EditProfile data={data} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
|
import { getProfile } from "@/app_modules/katalog/profile";
|
||||||
import { KatalogView } from "@/app_modules/katalog/view";
|
import { KatalogView } from "@/app_modules/katalog/view";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
return <>
|
const data = await getProfile();
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{/* {JSON.stringify(data)} */}
|
||||||
<KatalogView />
|
<KatalogView />
|
||||||
</>
|
</>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
export function myConsole(value: any) {
|
export function myConsole(value: any) {
|
||||||
const onData = false;
|
const onData = true;
|
||||||
if (onData) {
|
if (onData) {
|
||||||
console.log(value);
|
console.log(value);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user