diff --git a/prisma/schema.prisma b/prisma/schema.prisma index cff18aa3..e7de6186 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -54,6 +54,15 @@ model UserSession { userId String @unique } +model KodeOtp { + id String @id @default(cuid()) + isActive Boolean @default(true) + createdAt DateTime @default(now()) + updatedAt DateTime @updatedAt + nomor String + otp Int +} + model Profile { id String @id @default(cuid()) name String diff --git a/public/aset/investasi/home-hipmi.png b/public/aset/home/home-hipmi.png similarity index 100% rename from public/aset/investasi/home-hipmi.png rename to public/aset/home/home-hipmi.png diff --git a/src/app/api/auth/validasi/route.ts b/src/app/api/auth/validasi/route.ts index ba849d0e..be2bc349 100644 --- a/src/app/api/auth/validasi/route.ts +++ b/src/app/api/auth/validasi/route.ts @@ -4,9 +4,9 @@ import { NextResponse } from "next/server"; import { cookies } from "next/headers"; import { sealData, unsealData } from "iron-session"; import { getConfig } from "@/bin/config"; -import yaml from "yaml"; -import fs from "fs"; import { revalidatePath } from "next/cache"; +import fs from "fs"; +import yaml from "yaml"; const config = yaml.parse(fs.readFileSync("config.yaml").toString()); export async function POST(req: Request) { diff --git a/src/app/api/seeder/route.ts b/src/app/api/seeder/route.ts index ee22733d..c81e864f 100644 --- a/src/app/api/seeder/route.ts +++ b/src/app/api/seeder/route.ts @@ -39,23 +39,23 @@ export async function GET(req: Request) { }); } - for (let i of userSeeder) { - await prisma.user.upsert({ - where: { - nomor: i.nomor, - }, - create: { - nomor: i.nomor, - username: i.name, - masterUserRoleId: i.masterUserRoleId, - }, - update: { - nomor: i.nomor, - username: i.name, - masterUserRoleId: i.masterUserRoleId, - }, - }); - } + // for (let i of userSeeder) { + // await prisma.user.upsert({ + // where: { + // nomor: i.nomor, + // }, + // create: { + // nomor: i.nomor, + // username: i.name, + // masterUserRoleId: i.masterUserRoleId, + // }, + // update: { + // nomor: i.nomor, + // username: i.name, + // masterUserRoleId: i.masterUserRoleId, + // }, + // }); + // } for (let i of bidangBisnis) { await prisma.masterBidangBisnis.upsert({ diff --git a/src/app/dev/auth/login/layout.tsx b/src/app/dev/auth/login/layout.tsx new file mode 100644 index 00000000..79a8e50e --- /dev/null +++ b/src/app/dev/auth/login/layout.tsx @@ -0,0 +1,14 @@ +import { LayoutLogin } from "@/app_modules/auth"; +import React from "react"; + +export default async function Layout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + <> + {children} + > + ); +} diff --git a/src/app/dev/auth/login/page.tsx b/src/app/dev/auth/login/page.tsx index b36236db..9ef15c54 100644 --- a/src/app/dev/auth/login/page.tsx +++ b/src/app/dev/auth/login/page.tsx @@ -3,12 +3,10 @@ import { cookies } from "next/headers"; export default function Page() { const c = cookies().getAll(); - const tkn = c; return ( <> - {/* {JSON.stringify(tkn)} */} - ; + > ); } diff --git a/src/app/dev/auth/register/[id]/page.tsx b/src/app/dev/auth/register/[id]/page.tsx new file mode 100644 index 00000000..b17e670f --- /dev/null +++ b/src/app/dev/auth/register/[id]/page.tsx @@ -0,0 +1,8 @@ +import { Register } from "@/app_modules/auth"; +import { auth_getKodeOtpById } from "@/app_modules/auth/fun/get_kode_otp_by_id"; + +export default async function Page({ params }: { params: { id: string } }) { + let otpId = params.id + const dataOtp = await auth_getKodeOtpById(otpId) + return ; +} diff --git a/src/app/dev/auth/register/page.tsx b/src/app/dev/auth/register/page.tsx deleted file mode 100644 index f35d8b13..00000000 --- a/src/app/dev/auth/register/page.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { Register } from "@/app_modules/auth"; - -export default function Page() { - return ; -} diff --git a/src/app/dev/auth/validasi/layout.tsx b/src/app/dev/auth/validasi/[id]/layout.tsx similarity index 100% rename from src/app/dev/auth/validasi/layout.tsx rename to src/app/dev/auth/validasi/[id]/layout.tsx diff --git a/src/app/dev/auth/validasi/[id]/page.tsx b/src/app/dev/auth/validasi/[id]/page.tsx new file mode 100644 index 00000000..fbd553f8 --- /dev/null +++ b/src/app/dev/auth/validasi/[id]/page.tsx @@ -0,0 +1,9 @@ +import { Validasi } from "@/app_modules/auth"; +import { auth_getKodeOtpById } from "@/app_modules/auth/fun/get_kode_otp_by_id"; + +export default async function Page({ params }: { params: { id: string } }) { + let kodeOtpId = params.id; + const dataOtp = await auth_getKodeOtpById(kodeOtpId); + + return ; +} diff --git a/src/app/dev/auth/validasi/page.tsx b/src/app/dev/auth/validasi/page.tsx deleted file mode 100644 index 9f5a20d0..00000000 --- a/src/app/dev/auth/validasi/page.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { Validasi } from "@/app_modules/auth"; - - -export default function Page() { - - return ; -} diff --git a/src/app/lib/router_hipmi/router_auth.ts b/src/app/lib/router_hipmi/router_auth.ts new file mode 100644 index 00000000..6149df2b --- /dev/null +++ b/src/app/lib/router_hipmi/router_auth.ts @@ -0,0 +1,5 @@ +export const RouterAuth = { + login: "/dev/auth/login", + validasi: "/dev/auth/validasi/", + register: "/dev/auth/register/", +}; diff --git a/src/app_modules/admin/global_state/index.ts b/src/app_modules/admin/global_state/index.ts index 32e642b8..689ebfa2 100644 --- a/src/app_modules/admin/global_state/index.ts +++ b/src/app_modules/admin/global_state/index.ts @@ -5,6 +5,6 @@ import { atomWithStorage } from "jotai/utils"; * @type number * @ */ -export const gs_admin_hotMenu = atomWithStorage("gs_admin_hotMenu", 0) +export const gs_admin_hotMenu = atomWithStorage("gs_admin_hotMenu", 1) export const gs_admin_subMenu = atomWithStorage("gs_admin_subMenu",null) \ No newline at end of file diff --git a/src/app_modules/admin/layout.tsx b/src/app_modules/admin/layout.tsx index cda67e17..0a3ca7e1 100644 --- a/src/app_modules/admin/layout.tsx +++ b/src/app_modules/admin/layout.tsx @@ -52,8 +52,6 @@ export default function AdminLayout({ const [active, setActive] = useAtom(gs_admin_hotMenu); const [activeChild, setActiveChild] = useAtom(gs_admin_subMenu); - - const navbarItems = listAdminPage.map((e, i) => ( + + // + // + // + // + // + // + // } + + > + {children} + + > + ); +} diff --git a/src/app_modules/auth/login/view.tsx b/src/app_modules/auth/login/view.tsx index 77be0cff..bd93903c 100644 --- a/src/app_modules/auth/login/view.tsx +++ b/src/app_modules/auth/login/view.tsx @@ -1,101 +1,135 @@ "use client"; import { myConsole } from "@/app/fun/my_console"; -import { randomOTP } from "@/app/fun/rondom_otp"; +import { randomOTP } from "@/app_modules/auth/fun/rondom_otp"; import { ApiHipmi } from "@/app/lib/api"; import { Warna } from "@/app/lib/warna"; -import { Button, Center, Flex, Stack, TextInput, Title } from "@mantine/core"; +import { + Button, + Center, + Flex, + Grid, + Group, + Image, + Stack, + Text, + TextInput, + Title, +} from "@mantine/core"; import { getHotkeyHandler, useFocusTrap, useHotkeys } from "@mantine/hooks"; import { useRouter } from "next/navigation"; import { useState } from "react"; -import toast from "react-simple-toasts"; import { useAtom } from "jotai"; -import { gs_otp, gs_nomor } from "../state/state"; -import { IconCircleLetterH } from "@tabler/icons-react"; +import { gs_otp, gs_nomor, gs_kodeId } from "../state/state"; import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin"; import { NotifBerhasil } from "@/app_modules/donasi/component/notifikasi/notif_berhasil"; import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gagal"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; +import { auth_funLogin } from "@/app_modules/auth/fun/fun_login"; +import { RouterAuth } from "@/app/lib/router_hipmi/router_auth"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; export default function Login() { const router = useRouter(); const [nomor, setNomor] = useState(""); - const [inputNumber, setInputNumber] = useAtom(gs_nomor); - const [code, setCode] = useAtom(gs_otp); + const [kodeId, setKodeId] = useAtom(gs_kodeId); const focusTrapRef = useFocusTrap(); - const onLogin = async () => { - const body = { - nomor: nomor, - otp: randomOTP(), - }; + async function onLogin() { + if (nomor.length < 10) + return ComponentGlobal_NotifikasiPeringatan("Nomor minimal 10 digit"); + if (nomor.length > 13) + return ComponentGlobal_NotifikasiPeringatan("Nomor maximal 13 digit"); - if (body.nomor.length < 10) return toast("Nomor minimal 10 digit"); - if (body.nomor.length > 13) return toast("Nomor maximal 13 digit"); - await fetch(ApiHipmi.login, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(body), - }) - .then((res) => res.json()) - .then((val) => { - // console.log(val); - if (val.success === true) { - router.push(RouterAdminDashboard.splash_admin); - } else { - if (val.status == 200) { - setCode(val.body.otp); - setInputNumber(val.body.nomor); - router.push("/dev/auth/validasi"); - return NotifBerhasil("Nomor OTP terkirim"); - } else { - NotifGagal(val.message); - } - } - }); - }; + await auth_funLogin(nomor).then((res) => { + if (res.status === 200) { + ComponentGlobal_NotifikasiBerhasil(res.message, 2000); + setKodeId(res.kodeOtpId); + router.push(RouterAuth.validasi + res.kodeOtpId); + } else { + ComponentGlobal_NotifikasiPeringatan(res.message); + } + }); + + // await fetch(ApiHipmi.login, { + // method: "POST", + // headers: { + // "Content-Type": "application/json", + // }, + // body: JSON.stringify(body), + // }) + // .then((res) => res.json()) + // .then((val) => { + // // console.log(val); + // if (val.success === true) { + // router.push(RouterAdminDashboard.splash_admin); + // } else { + // if (val.status == 200) { + // setCode(val.body.otp); + // setInputNumber(val.body.nomor); + // router.push("/dev/auth/validasi"); + // return NotifBerhasil("Nomor OTP terkirim"); + // } else { + // NotifGagal(val.message); + // } + // } + // }); + } return ( <> - - - Login - { - setNomor(val.target.value); - }} - /> + + + + + + + Selamat Datang di HIPMI App + + Silahkan masukan nomor telepon anda untuk masuk ! + + - { - onLogin(); - }} - > - Login - - + + + + +62 + + + + { + setNomor(62 + val.target.value); + }} + /> + + + + { + onLogin(); + }} + > + LOGIN + + + > ); } diff --git a/src/app_modules/auth/logout/view.tsx b/src/app_modules/auth/logout/view.tsx index 58ffe935..89f282b2 100644 --- a/src/app_modules/auth/logout/view.tsx +++ b/src/app_modules/auth/logout/view.tsx @@ -1,36 +1,45 @@ "use client"; -import { myConsole } from "@/app/fun/my_console"; -import { ApiHipmi } from "@/app/lib/api"; + import { ActionIcon, Button, Group, Modal, Stack, Title } from "@mantine/core"; import { useRouter } from "next/navigation"; import { useAtom } from "jotai"; -import { gs_nomor, gs_otp } from "../state/state"; +import { gs_kodeId, gs_nomor, gs_otp } from "../state/state"; import { IconLogout } from "@tabler/icons-react"; import { Warna } from "@/app/lib/warna"; import { useDisclosure } from "@mantine/hooks"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; +import { auth_Logout } from "../fun/fun_logout"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; export default function User_Logout() { const router = useRouter(); - const [nomor, setnomor] = useAtom(gs_nomor); - const [code, setCode] = useAtom(gs_otp); - const [opened, { toggle }] = useDisclosure(false); + const [kodeId, setKodeId] = useAtom(gs_kodeId); const onLogout = async () => { - await fetch(ApiHipmi.logout) - .then((res) => res.json()) - .then((val) => { - if (val.status == 200) { - setnomor(null); - setCode(null); - - ComponentGlobal_NotifikasiBerhasil("Anda Berhasil Logout") - return router.push("/dev/auth/login"); - } - }); + // await fetch(ApiHipmi.logout) + // .then((res) => res.json()) + // .then((val) => { + // if (val.status == 200) { + // setnomor(null); + // setCode(null); + // ComponentGlobal_NotifikasiBerhasil("Anda Berhasil Logout") + // return router.push("/dev/auth/login"); + // } + // }); }; + async function onClickLogout() { + await auth_Logout(kodeId).then((res) => { + if (res.status === 200) { + setKodeId(""); + ComponentGlobal_NotifikasiBerhasil(res.message); + } else { + ComponentGlobal_NotifikasiPeringatan(res.message); + } + }); + } + return ( <> @@ -45,7 +54,7 @@ export default function User_Logout() { radius={50} bg={Warna.merah} color="red" - onClick={() => onLogout()} + onClick={() => onClickLogout()} > Keluar diff --git a/src/app_modules/auth/register/view.tsx b/src/app_modules/auth/register/view.tsx index 9fa289ca..6e44c0ee 100644 --- a/src/app_modules/auth/register/view.tsx +++ b/src/app_modules/auth/register/view.tsx @@ -1,8 +1,17 @@ "use client"; import { Warna } from "@/app/lib/warna"; -import { Flex, Title, TextInput, Button, Text } from "@mantine/core"; -import { IconCircleLetterH } from "@tabler/icons-react"; +import { + Flex, + Title, + TextInput, + Button, + Text, + Center, + PinInput, + Stack, +} from "@mantine/core"; +import { IconCircleLetterH, IconCloudLockOpen } from "@tabler/icons-react"; import { gs_nomor } from "../state/state"; import { useAtom } from "jotai"; import { useState } from "react"; @@ -12,46 +21,79 @@ import { ApiHipmi } from "@/app/lib/api"; import { useRouter } from "next/navigation"; import _ from "lodash"; import { useFocusTrap } from "@mantine/hooks"; +import { Auth_funRegister } from "../fun/fun_register"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; +import { IconPencilCheck } from "@tabler/icons-react"; +import { RouterHome } from "@/app/lib/router_hipmi/router_home"; +import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id"; -export default function Register() { - const route = useRouter(); - const [nomor, setNomor] = useAtom(gs_nomor); +export default function Register({ dataOtp }: { dataOtp: any }) { + const router = useRouter(); + const [nomor, setNomor] = useState(dataOtp.nomor); const [value, setValue] = useState(""); const focusTrapRef = useFocusTrap(); - const onRegister = async () => { - myConsole(value); + // const onRegister = async () => { + // myConsole(value); + // const body = { + // username: _.lowerCase(value), + // nomor: nomor, + // }; + + // if (!body) return toast("Lengkapi username"); + // if (body.username.length < 5) return toast("Username minimal 5 karakter"); + + // await fetch(ApiHipmi.register, { + // method: "POST", + // headers: { + // "Content-Type": "application/json", + // }, + // body: JSON.stringify(body), + // }) + // .then((res) => res.json()) + // .then((val) => { + // myConsole(val); + // if (val.status == 201) { + // toast("Pendaftaran Berhasil"); + // return route.push("/dev/home"); + // } else { + // return toast(val.message); + // } + // }); + // }; + + async function onRegistarsi() { const body = { username: _.lowerCase(value), nomor: nomor, }; - if (!body) return toast("Lengkapi username"); - if (body.username.length < 5) return toast("Username minimal 5 karakter"); + if (_.values(body.username).includes("")) + return ComponentGlobal_NotifikasiPeringatan("Lengkapi Username"); + if (body.username.length < 5) + return ComponentGlobal_NotifikasiPeringatan("Username minimal 5 krakter"); - await fetch(ApiHipmi.register, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(body), - }) - .then((res) => res.json()) - .then((val) => { - myConsole(val); - if (val.status == 201) { - toast("Pendaftaran Berhasil"); - return route.push("/dev/home"); - } else { - return toast(val.message); - } - }); - }; + await Auth_funRegister(body).then(async (res) => { + if (res.status === 200) { + await auth_funEditAktivasiKodeOtpById(dataOtp.id).then((val) => { + if (val.status === 200) { + ComponentGlobal_NotifikasiBerhasil(res.message); + router.push(RouterHome.main_home); + } else { + ComponentGlobal_NotifikasiPeringatan(val.message); + } + }); + } else { + ComponentGlobal_NotifikasiPeringatan(res.message); + } + }); + } return ( <> - - + */} + + {/* {JSON.stringify(dataOtp,null,2)} */} + + + + + + + + + + REGISTRASI + Masukan username anda ! + + + { + setValue(val.currentTarget.value); + }} + /> + + Anda akan terdaftar dengan nomor berikut{" "} + + +{nomor} + + + + + + { + onRegistarsi(); + }} + > + DAFTAR + + + + + > ); } diff --git a/src/app_modules/auth/state/state.ts b/src/app_modules/auth/state/state.ts index 04c96225..1ce89583 100644 --- a/src/app_modules/auth/state/state.ts +++ b/src/app_modules/auth/state/state.ts @@ -1,4 +1,6 @@ import { atomWithStorage } from 'jotai/utils' export const gs_nomor = atomWithStorage("nomorHp", null) -export const gs_otp = atomWithStorage("code_otp", null) \ No newline at end of file +export const gs_otp = atomWithStorage("code_otp", null) + +export const gs_kodeId = atomWithStorage("gs_kodeId", ""); \ No newline at end of file diff --git a/src/app_modules/auth/validasi/view.tsx b/src/app_modules/auth/validasi/view.tsx index aa7e8284..d84e8d71 100644 --- a/src/app_modules/auth/validasi/view.tsx +++ b/src/app_modules/auth/validasi/view.tsx @@ -15,7 +15,11 @@ import { gs_nomor, gs_otp } from "../state/state"; import { Warna } from "@/app/lib/warna"; import { useState } from "react"; import { myConsole } from "@/app/fun/my_console"; -import { IconChevronLeft, IconCircleLetterH } from "@tabler/icons-react"; +import { + IconChevronLeft, + IconCircleLetterH, + IconCloudLockOpen, +} from "@tabler/icons-react"; import toast from "react-simple-toasts"; import { ApiHipmi } from "@/app/lib/api"; import { useRouter } from "next/navigation"; @@ -24,12 +28,18 @@ import { useFocusTrap } from "@mantine/hooks"; import { NotifBerhasil } from "@/app_modules/donasi/component/notifikasi/notif_berhasil"; import { NotifGagal } from "@/app_modules/donasi/component/notifikasi/notif_gagal"; import { NotifPeringatan } from "@/app_modules/donasi/component/notifikasi/notif_peringatan"; +import Countdown from "react-countdown"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan"; +import { auth_funValidasi } from "../fun/fun_validasi"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; +import { RouterAuth } from "@/app/lib/router_hipmi/router_auth"; +import { RouterHome } from "@/app/lib/router_hipmi/router_home"; +import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id"; -export default function Validasi() { +export default function Validasi({ dataOtp }: { dataOtp: any }) { const router = useRouter(); - const [nomor, setnomor] = useAtom(gs_nomor); - const [code, setCode] = useAtom(gs_otp); - + const [nomor, setnomor] = useState(dataOtp.nomor); + const [code, setCode] = useState(dataOtp.otp); const [inputCode, setInputOtp] = useState(""); const focusTrapRef = useFocusTrap(); @@ -43,34 +53,53 @@ export default function Validasi() { if (!inputCode) return toast("Lengkapi Kode"); if (body.otp != inputCode) return toast("Kode Salah"); - await fetch(ApiHipmi.validasi, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(body), - }) - .then((res) => res.json()) - .then((val) => { - myConsole(val); - if (val.status == 200) { - setTimeout(() => router.push("/dev/home"), 2000); - funGetUserProfile(val.data.id); - NotifBerhasil("Berhasil Login"); - } else { - router.push("/dev/auth/register"); - NotifPeringatan("Silahkan Registrasi"); - } - }); + // await fetch(ApiHipmi.validasi, { + // method: "POST", + // headers: { + // "Content-Type": "application/json", + // }, + // body: JSON.stringify(body), + // }) + // .then((res) => res.json()) + // .then((val) => { + // myConsole(val); + // if (val.status == 200) { + // setTimeout(() => router.push("/dev/home"), 2000); + // funGetUserProfile(val.data.id); + // NotifBerhasil("Berhasil Login"); + // } else { + // router.push("/dev/auth/register"); + // NotifPeringatan("Silahkan Registrasi"); + // } + // }); }; + async function onVerifikasi() { + if (!inputCode) + return ComponentGlobal_NotifikasiPeringatan("Lengkapi Kode"); + if (code != inputCode) + return ComponentGlobal_NotifikasiPeringatan("Kode Salah"); + + await auth_funValidasi(nomor).then(async (res) => { + if (res.status === 200) { + await auth_funEditAktivasiKodeOtpById(dataOtp.id).then((val) => { + if (val.status === 200) { + ComponentGlobal_NotifikasiBerhasil(res.message); + router.push(RouterHome.main_home); + } else { + ComponentGlobal_NotifikasiPeringatan(val.message); + } + }); + } else { + ComponentGlobal_NotifikasiBerhasil(res.message); + router.push(RouterAuth.register + dataOtp.id); + } + }); + } + return ( <> - {/* {JSON.stringify(nomor)} - {JSON.stringify(code)} */} - - - - + */} + + {/* {JSON.stringify(code)} */} + + + + + + + + + + Verifikasi Kode OTP + + Silahkan masukan 4 digit kode otp yang dikirim ke{" "} + + +{nomor} + + + + + + { + setInputOtp(val); + }} + /> + + + { + onVerifikasi(); + }} + > + VERIFIKASI + + + + + > ); } diff --git a/src/app_modules/fun_global/get_user_token.ts b/src/app_modules/fun_global/get_user_token.ts index ed8e890f..5c22838d 100644 --- a/src/app_modules/fun_global/get_user_token.ts +++ b/src/app_modules/fun_global/get_user_token.ts @@ -5,11 +5,12 @@ import yaml from "yaml"; import fs from "fs"; import { unsealData } from "iron-session"; import { redirect } from "next/navigation"; +import { RouterAuth } from "@/app/lib/router_hipmi/router_auth"; const config = yaml.parse(fs.readFileSync("config.yaml").toString()); export async function User_getUserId() { const c = cookies().get("ssn"); - if (!c?.value) return redirect("/dev/auth/login"); + if (!c?.value) return redirect(RouterAuth.login); const token = JSON.parse( await unsealData(c?.value as string, { diff --git a/src/app_modules/home/layout.tsx b/src/app_modules/home/layout.tsx index 0ad27c8c..88ac839b 100644 --- a/src/app_modules/home/layout.tsx +++ b/src/app_modules/home/layout.tsx @@ -68,6 +68,7 @@ export default function HomeLayout({ HIPMI + {/* diff --git a/src/app_modules/home/view.tsx b/src/app_modules/home/view.tsx index ac100e7d..0a210a90 100644 --- a/src/app_modules/home/view.tsx +++ b/src/app_modules/home/view.tsx @@ -96,7 +96,7 @@ export default function HomeView({ dataUser }: { dataUser: MODEL_USER }) { <> - + {/* {JSON.stringify(stateUser, null, 2)} */}
{JSON.stringify(dataOtp,null,2)}
{JSON.stringify(code)}
{JSON.stringify(stateUser, null, 2)}