feat: tambah dependensi 'jose' versi 5.9.2 pada package.json
refactor: rapikan identasi dan buat field 'expires' opsional di model UserSession pada schema prisma chore: bersihkan import tidak terpakai di route login dan register API
This commit is contained in:
5
src/app_modules/check_cookies/index.ts
Normal file
5
src/app_modules/check_cookies/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { CheckCookies_UiLayout } from "./layout_cek_cookies";
|
||||
import { CheckCookies_UiView } from "./ui_check_cookies";
|
||||
|
||||
export { CheckCookies_UiView };
|
||||
export { CheckCookies_UiLayout };
|
||||
27
src/app_modules/check_cookies/layout_cek_cookies.tsx
Normal file
27
src/app_modules/check_cookies/layout_cek_cookies.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export function CheckCookies_UiLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const router = useRouter();
|
||||
|
||||
useShallowEffect(() => {
|
||||
onCheckCookies();
|
||||
}, []);
|
||||
|
||||
async function onCheckCookies() {
|
||||
const cek = await fetch("/api/check-cookies");
|
||||
const result = await cek.json();
|
||||
if (result.success === false) {
|
||||
router.push(RouterAuth.login);
|
||||
}
|
||||
}
|
||||
|
||||
return <>{children}</>;
|
||||
}
|
||||
23
src/app_modules/check_cookies/ui_check_cookies.tsx
Normal file
23
src/app_modules/check_cookies/ui_check_cookies.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import { Button, Center } from "@mantine/core";
|
||||
import { UIGlobal_LayoutTamplate } from "../_global/ui";
|
||||
import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
|
||||
export function CheckCookies_UiView() {
|
||||
const router = useRouter();
|
||||
|
||||
return (
|
||||
<>
|
||||
<UIGlobal_LayoutTamplate>
|
||||
<Center h={"80vh"}>
|
||||
<Button radius={"xl"} onClick={() => router.push(RouterAuth.login)}>
|
||||
Kembali ke Halaman Login
|
||||
</Button>
|
||||
</Center>
|
||||
</UIGlobal_LayoutTamplate>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user