Fix: Middlerawe/3

This commit is contained in:
2024-11-21 16:16:50 +08:00
parent ac749f3d9d
commit 10dee19f98
4 changed files with 3 additions and 22 deletions

View File

@@ -42,7 +42,7 @@ export default async function RootLayout({
children: React.ReactNode;
}) {
// if (!token) return <>Require Token Storage</>;
// const userLoginId = await funGetUserIdByToken();
const userLoginId = await funGetUserIdByToken();
return (
<RootStyleRegistry>

View File

@@ -1,17 +0,0 @@
"use server";
import { prisma } from "@/app/lib";
import _ from "lodash";
import { cookies } from "next/headers";
export async function funCheckToken() {
const c = cookies().get("mySession");
const cekToken = await prisma.userSession.findFirst({
where: {
token: c?.value,
},
});
if (cekToken === null) return false;
return true;
}

View File

@@ -5,8 +5,7 @@ import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
import { permanentRedirect } from "next/navigation";
export async function funGlobal_getUserById({ userId }: { userId: string }) {
if (!userId) return permanentRedirect(RouterAuth.login);
// if (!userId) return permanentRedirect(RouterAuth.login);
const data = await prisma.user.findFirst({
where: {
id: userId,

View File

@@ -1,4 +1,4 @@
import { funCheckToken } from "./fun_cek_token";
import { funGlobal_CheckProfile } from "./fun_check_profile";
import { funGlobal_getNomorAdmin } from "./fun_get_nomor_admin";
import { funGetUserIdByToken } from "./fun_get_user_id_by_token";
@@ -6,6 +6,5 @@ import { funGlobal_getMasterKategoriApp } from "./fun_master_kategori_app";
export { funGlobal_getMasterKategoriApp };
export { funGlobal_getNomorAdmin };
export { funCheckToken };
export { funGetUserIdByToken };
export { funGlobal_CheckProfile };