fix folder
deskripsi: - ganti nama folder (user) ke (auth) - hapus folder auth
This commit is contained in:
@@ -21,3 +21,4 @@
|
||||
{"clientVersion":"6.3.0","code":"UND_ERR_SOCKET","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed","meta":{"modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed\n at new PrismaClientKnownRequestError (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:148:1500)\n at handleRequestError (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:7367)\n at handleAndLogRequestError (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:6687)\n at <anonymous> (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:6394)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:35:53.417Z"}
|
||||
{"id":"c65237f0-e0cf-4961-9454-2405c4f4fe05","level":"info","message":"Success send message","status":"success","timestamp":"2025-02-05T06:41:30.785Z"}
|
||||
{"clientVersion":"6.3.0","code":"UND_ERR_SOCKET","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed","meta":{"modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:53:59.012Z"}
|
||||
{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at Object.e_ [as staticGenerationBailout] (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27571)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32508)\n at Object.get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32604)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1219)\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39715\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36\n at NoopContextManager.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)\n at ContextAPI.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)\n at NoopTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)\n at ProxyTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)","timestamp":"2025-02-05T07:23:58.983Z"}
|
||||
|
||||
@@ -20,3 +20,4 @@
|
||||
{"clientVersion":"6.3.0","code":"P2025","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.","meta":{"cause":"Record to delete does not exist.","modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nAn operation failed because it depends on one or more records that were required but not found. Record to delete does not exist.\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:25:00.029Z"}
|
||||
{"clientVersion":"6.3.0","code":"UND_ERR_SOCKET","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed","meta":{"modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed\n at new PrismaClientKnownRequestError (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:148:1500)\n at handleRequestError (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:7367)\n at handleAndLogRequestError (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:6687)\n at <anonymous> (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/@prisma/client/runtime/binary.js:258:6394)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:35:53.417Z"}
|
||||
{"clientVersion":"6.3.0","code":"UND_ERR_SOCKET","level":"error","message":"Error deleting OTP: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed","meta":{"modelName":"KodeOtp"},"name":"PrismaClientKnownRequestError","stack":"PrismaClientKnownRequestError: \nInvalid `prisma.kodeOtp.delete()` invocation:\n\n\nother side closed\n at new PrismaClientKnownRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:148:1505)\n at handleRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:7369)\n at handleAndLogRequestError (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6705)\n at <anonymous> (webpack-internal:///(ssr)/./node_modules/@prisma/client/runtime/binary.js:258:6418)\n at processTicksAndRejections (native:7:39)","timestamp":"2025-02-05T06:53:59.012Z"}
|
||||
{"digest":"DYNAMIC_SERVER_USAGE","level":"error","message":"Error get data detail event: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error","stack":"Error: Dynamic server usage: Page couldn't be rendered statically because it used `request.url`. See more info here: https://nextjs.org/docs/messages/dynamic-server-error\n at Object.e_ [as staticGenerationBailout] (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:27571)\n at i (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32508)\n at Object.get (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:32604)\n at GET (/Users/bagasbanuna/Documents/BIP/hipmi/.next/server/app/api/event/check-peserta/route.js:1:1219)\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:14:39715\n at /Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/server/lib/trace/tracer.js:121:36\n at NoopContextManager.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7057)\n at ContextAPI.with (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:516)\n at NoopTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18086)\n at ProxyTracer.startActiveSpan (/Users/bagasbanuna/Documents/BIP/hipmi/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18847)","timestamp":"2025-02-05T07:23:58.983Z"}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { sessionCreate } from "@/app/auth/_lib/session_create";
|
||||
import { sessionCreate } from "@/app/(auth)/_lib/session_create";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { sessionCreate } from "@/app/auth/_lib/session_create";
|
||||
import { sessionCreate } from "@/app/(auth)/_lib/session_create";
|
||||
import prisma from "@/app/lib/prisma";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { decrypt } from "@/app/auth/_lib/decrypt";
|
||||
import { decrypt } from "@/app/(auth)/_lib/decrypt";
|
||||
import { prisma } from "@/app/lib";
|
||||
import { cookies } from "next/headers";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { decrypt } from "@/app/auth/_lib/decrypt";
|
||||
import { decrypt } from "@/app/(auth)/_lib/decrypt";
|
||||
import _ from "lodash";
|
||||
import { cookies } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import { decrypt } from "@/app/auth/_lib/decrypt";
|
||||
import { decrypt } from "@/app/(auth)/_lib/decrypt";
|
||||
import _ from "lodash";
|
||||
import { cookies } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import { prisma } from "@/app/lib";
|
||||
import { sessionCreate } from "../../_lib/session_create";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function POST(req: Request) {
|
||||
const user = await prisma.user.findUnique({
|
||||
where: {
|
||||
nomor: "6281339158911",
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
nomor: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!user) return NextResponse.json({ success: false }, { status: 404 });
|
||||
|
||||
const token = await sessionCreate({
|
||||
sessionKey: process.env.NEXT_PUBLIC_BASE_SESSION_KEY!,
|
||||
encodedKey: process.env.NEXT_PUBLIC_BASE_TOKEN_KEY!,
|
||||
user: user as any,
|
||||
});
|
||||
|
||||
return NextResponse.json({ success: true, token });
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { cookies } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET() {
|
||||
const del = cookies().delete(process.env.NEXT_PUBLIC_BASE_SESSION_KEY!);
|
||||
|
||||
return NextResponse.json({ success: true, message: "Logout Berhasil" });
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
"use client";
|
||||
import { Button } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function Page() {
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
|
||||
async function login() {
|
||||
setLoading(true);
|
||||
try {
|
||||
const res = await fetch("/auth/api/login", {
|
||||
method: "POST",
|
||||
});
|
||||
|
||||
const dataText = await res.text();
|
||||
|
||||
if (!res.ok) {
|
||||
console.error(dataText);
|
||||
throw new Error(res.statusText);
|
||||
}
|
||||
|
||||
const dataJson = JSON.parse(dataText);
|
||||
console.log(dataJson);
|
||||
// window.location.replace("/dev/home");
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Button loading={loading} onClick={login}>
|
||||
Login
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
"use server";
|
||||
|
||||
import { cookies } from "next/headers";
|
||||
import { decrypt } from "../../../../app/auth/_lib/decrypt";
|
||||
import { decrypt } from "../../../../app/(auth)/_lib/decrypt";
|
||||
|
||||
export async function funGetUserIdByToken() {
|
||||
const SESSION_KEY = process.env.NEXT_PUBLIC_BASE_SESSION_KEY!;
|
||||
|
||||
@@ -24,33 +24,27 @@ export default function Register() {
|
||||
const [isValue, setIsValue] = useState(false);
|
||||
const focusTrapRef = useFocusTrap();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [idCode, setIdCode] = useState("");
|
||||
|
||||
useShallowEffect(() => {
|
||||
const kodeId = localStorage.getItem("hipmi_auth_code_id");
|
||||
if (kodeId != null) {
|
||||
onCheckAuthCode({ kodeId: kodeId as string, onSetData: setNomor });
|
||||
onCheckAuthCode({ kodeId: kodeId as string });
|
||||
} else {
|
||||
console.log("code id not found");
|
||||
}
|
||||
}, [setNomor]);
|
||||
}, []);
|
||||
|
||||
async function onCheckAuthCode({
|
||||
kodeId,
|
||||
onSetData,
|
||||
}: {
|
||||
kodeId: string;
|
||||
onSetData: any;
|
||||
}) {
|
||||
async function onCheckAuthCode({ kodeId }: { kodeId: string }) {
|
||||
try {
|
||||
const respone = await apiGetCheckCodeOtp({ id: kodeId });
|
||||
if (respone) {
|
||||
onSetData(respone.nomor);
|
||||
setIdCode(kodeId);
|
||||
setNomor(respone.nomor);
|
||||
}
|
||||
} catch (error) {
|
||||
clientLogger.error("Error onCheckAuthCode:", error);
|
||||
}
|
||||
// const res = await fetch(`/api/auth/check?id=${kodeId}`);
|
||||
// const result = await res.json();
|
||||
}
|
||||
|
||||
async function onRegistarsi() {
|
||||
|
||||
@@ -181,18 +181,22 @@ export default function Validasi() {
|
||||
<>
|
||||
<UIGlobal_LayoutDefault>
|
||||
<Stack h={"100vh"}>
|
||||
<Box
|
||||
pt={"md"}
|
||||
px={"md"}
|
||||
style={{
|
||||
position: "sticky",
|
||||
top: 0,
|
||||
}}
|
||||
>
|
||||
<ActionIcon variant="transparent" onClick={() => onBack()}>
|
||||
<IconChevronLeft color="white" />
|
||||
</ActionIcon>
|
||||
</Box>
|
||||
{data && data.nomor !== "" ? (
|
||||
<Box
|
||||
pt={"md"}
|
||||
px={"md"}
|
||||
style={{
|
||||
position: "sticky",
|
||||
top: 0,
|
||||
}}
|
||||
>
|
||||
<ActionIcon variant="transparent" onClick={() => onBack()}>
|
||||
<IconChevronLeft color="white" />
|
||||
</ActionIcon>
|
||||
</Box>
|
||||
) : (
|
||||
""
|
||||
)}
|
||||
|
||||
<Stack align="center" justify="center" h={"100vh"} spacing={50}>
|
||||
<Title order={2} color={MainColor.yellow}>
|
||||
|
||||
Reference in New Issue
Block a user