fix: event
- deskripsi: - fix use server untuk pengambilan userid , sekarang menggunakan API
This commit is contained in:
34
src/app/api/master/tipe-acara/route.ts
Normal file
34
src/app/api/master/tipe-acara/route.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import prisma from "@/lib/prisma";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
try {
|
||||
const data = await prisma.eventMaster_TipeAcara.findMany({
|
||||
orderBy: {
|
||||
id: "asc",
|
||||
},
|
||||
where: {
|
||||
active: true,
|
||||
},
|
||||
});
|
||||
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: true,
|
||||
message: "Berhasil mendapatkan data",
|
||||
data: data,
|
||||
},
|
||||
{ status: 200 }
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Error Get Master Tipe Acara ", error);
|
||||
return NextResponse.json(
|
||||
{
|
||||
success: false,
|
||||
message: "API Error Get Data",
|
||||
reason: (error as Error).message,
|
||||
},
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,5 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Event_Create } from "@/app_modules/event";
|
||||
import { Event_getMasterTipeAcara } from "@/app_modules/event/fun/master/get_tipe_acara";
|
||||
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
const listTipeAcara = await Event_getMasterTipeAcara();
|
||||
|
||||
return (
|
||||
<Event_Create
|
||||
listTipeAcara={listTipeAcara as any}
|
||||
authorId={userLoginId as string}
|
||||
/>
|
||||
);
|
||||
return <Event_Create />;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ import LayoutEvent_DetailSponsor from '@/app_modules/event/detail/detail_sponsor
|
||||
import React from 'react';
|
||||
|
||||
async function Layout({children} : {children: React.ReactNode}) {
|
||||
const userLoginId = await funGetUserIdByToken()
|
||||
// const userLoginId = await funGetUserIdByToken()
|
||||
return (
|
||||
<>
|
||||
<LayoutEvent_DetailSponsor userLoginId={userLoginId}>
|
||||
<LayoutEvent_DetailSponsor userLoginId={""}>
|
||||
{children}
|
||||
</LayoutEvent_DetailSponsor>
|
||||
</>
|
||||
|
||||
@@ -3,10 +3,10 @@ import DetailSponsor_Event from '@/app_modules/event/detail/detail_sponsor';
|
||||
import React from 'react';
|
||||
|
||||
async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
// const userLoginId = await funGetUserIdByToken();
|
||||
return (
|
||||
<>
|
||||
<DetailSponsor_Event userLoginId={userLoginId} />
|
||||
<DetailSponsor_Event userLoginId={""} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { Event_DetailMain } from "@/app_modules/event";
|
||||
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
<Event_DetailMain
|
||||
userLoginId={userLoginId as string}
|
||||
/>
|
||||
<Event_DetailMain />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import { LayoutEvent_Edit } from "@/app_modules/event";
|
||||
import React from "react";
|
||||
|
||||
export default async function Layout({children}: {children: React.ReactNode}) {
|
||||
return <>
|
||||
<LayoutEvent_Edit>{children}</LayoutEvent_Edit>
|
||||
export default async function Layout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<LayoutEvent_Edit>{children}</LayoutEvent_Edit>
|
||||
</>
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,25 +1,9 @@
|
||||
import { Event_Edit } from "@/app_modules/event";
|
||||
import { event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
|
||||
import { Event_getMasterTipeAcara } from "@/app_modules/event/fun/master/get_tipe_acara";
|
||||
import _ from "lodash";
|
||||
|
||||
export default async function Page({ params }: { params: { id: string } }) {
|
||||
let eventId = params.id;
|
||||
const data = await event_getOneById(eventId);
|
||||
const dataEvent = _.omit(data, [
|
||||
"Author",
|
||||
"EventMaster_Status",
|
||||
"Event_Peserta",
|
||||
"createdAt",
|
||||
"updatedAt",
|
||||
"active",
|
||||
]);
|
||||
|
||||
const listTipeAcara = await Event_getMasterTipeAcara()
|
||||
|
||||
export default async function Page() {
|
||||
return (
|
||||
<>
|
||||
<Event_Edit dataEvent={dataEvent as any} listTipeAcara={listTipeAcara as any}/>
|
||||
<Event_Edit />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ import Event_Invoice from '@/app_modules/event/detail/invoice';
|
||||
import React from 'react';
|
||||
|
||||
async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
// const userLoginId = await funGetUserIdByToken();
|
||||
return (
|
||||
<>
|
||||
<Event_Invoice userLoginId={userLoginId} />
|
||||
<Event_Invoice userLoginId={""} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import UiEvent_V2_Konfirmasi from "@/app_modules/event/_ui/V2_konfirmasi";
|
||||
|
||||
export default async function Page() {
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* <Ui_Konfirmasi userLoginId={userLoginId as string} /> */}
|
||||
<UiEvent_V2_Konfirmasi userLoginId={userLoginId as string} />
|
||||
<UiEvent_V2_Konfirmasi />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,6 @@
|
||||
import { Event_StatusPage } from "@/app_modules/event";
|
||||
import {
|
||||
event_getAllByStatusId,
|
||||
event_getMasterStatus,
|
||||
} from "@/app_modules/event/fun";
|
||||
|
||||
async function Page({ params }: { params: { id: string } }) {
|
||||
// let statusId = params.id;
|
||||
// const listStatus = await event_getMasterStatus();
|
||||
|
||||
// const dataStatus = await event_getAllByStatusId({
|
||||
// page: 1,
|
||||
// statusId: statusId,
|
||||
// });
|
||||
|
||||
return (
|
||||
<>
|
||||
<Event_StatusPage />
|
||||
|
||||
Reference in New Issue
Block a user