fix prisma import
This commit is contained in:
@@ -12,8 +12,6 @@ export const apiGetUserId = async () => {
|
||||
},
|
||||
});
|
||||
|
||||
console.log("Ini di pemanggilan API", await response.json());
|
||||
|
||||
if (!response.ok) return null;
|
||||
const data: Record<string, any> = await response.json();
|
||||
return data;
|
||||
|
||||
@@ -5,28 +5,37 @@ import { MODEL_EVENT_PESERTA } from "../../_lib/interface";
|
||||
import { revalidatePath } from "next/cache";
|
||||
|
||||
export async function Event_funJoinEvent(data: MODEL_EVENT_PESERTA) {
|
||||
const res = await prisma.event_Peserta.create({
|
||||
data: {
|
||||
eventId: data.eventId,
|
||||
userId: data.userId,
|
||||
},
|
||||
try {
|
||||
console.log("Data >", data)
|
||||
const res = await prisma.event_Peserta.create({
|
||||
data: {
|
||||
eventId: data.eventId,
|
||||
userId: data.userId,
|
||||
},
|
||||
|
||||
select: {
|
||||
Event: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
authorId: true,
|
||||
select: {
|
||||
Event: {
|
||||
select: {
|
||||
id: true,
|
||||
title: true,
|
||||
authorId: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
if (!res) return { status: 400, message: "Gagal Join" };
|
||||
revalidatePath("/dev/event/detail/main");
|
||||
return {
|
||||
data: res,
|
||||
status: 200,
|
||||
message: "Berhasil Join",
|
||||
};
|
||||
if (!res) return { status: 400, message: "Gagal Join" };
|
||||
revalidatePath("/dev/event/detail/main");
|
||||
return {
|
||||
data: res,
|
||||
status: 200,
|
||||
message: "Berhasil Join",
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
status: 500,
|
||||
message: "Error Join",
|
||||
error: (error as Error).message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
"use client";
|
||||
|
||||
import { RouterEvent } from "@/lib/router_hipmi/router_event";
|
||||
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
|
||||
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
|
||||
import { globalStatusApp } from "@/app_modules/_global/lib";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { RouterEvent } from "@/lib/router_hipmi/router_event";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import { Box, Center, Stack } from "@mantine/core";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import _ from "lodash";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { useParams } from "next/navigation";
|
||||
import { useState } from "react";
|
||||
import ComponentEvent_BoxListStatus from "../../component/box_list_status";
|
||||
import { event_getAllByStatusId } from "../../fun";
|
||||
import { MODEL_EVENT } from "../../_lib/interface";
|
||||
import { useParams } from "next/navigation";
|
||||
import { globalStatusApp } from "@/app_modules/_global/lib";
|
||||
import { apiGetJobByStatus } from "@/app_modules/job/component/api_fetch_job";
|
||||
import { clientLogger } from "@/util/clientLogger";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
|
||||
import { apiGetEventByStatus } from "../../component/button/api_fetch_event";
|
||||
|
||||
export default function Event_ViewStatus() {
|
||||
|
||||
Reference in New Issue
Block a user