Fix: Middlerawe/3
This commit is contained in:
@@ -42,7 +42,7 @@ export default async function RootLayout({
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
// if (!token) return <>Require Token Storage</>;
|
// if (!token) return <>Require Token Storage</>;
|
||||||
// const userLoginId = await funGetUserIdByToken();
|
const userLoginId = await funGetUserIdByToken();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RootStyleRegistry>
|
<RootStyleRegistry>
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -5,8 +5,7 @@ import { RouterAuth } from "@/app/lib/router_hipmi/router_auth";
|
|||||||
import { permanentRedirect } from "next/navigation";
|
import { permanentRedirect } from "next/navigation";
|
||||||
|
|
||||||
export async function funGlobal_getUserById({ userId }: { userId: string }) {
|
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({
|
const data = await prisma.user.findFirst({
|
||||||
where: {
|
where: {
|
||||||
id: userId,
|
id: userId,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { funCheckToken } from "./fun_cek_token";
|
|
||||||
import { funGlobal_CheckProfile } from "./fun_check_profile";
|
import { funGlobal_CheckProfile } from "./fun_check_profile";
|
||||||
import { funGlobal_getNomorAdmin } from "./fun_get_nomor_admin";
|
import { funGlobal_getNomorAdmin } from "./fun_get_nomor_admin";
|
||||||
import { funGetUserIdByToken } from "./fun_get_user_id_by_token";
|
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_getMasterKategoriApp };
|
||||||
export { funGlobal_getNomorAdmin };
|
export { funGlobal_getNomorAdmin };
|
||||||
export { funCheckToken };
|
|
||||||
export { funGetUserIdByToken };
|
export { funGetUserIdByToken };
|
||||||
export { funGlobal_CheckProfile };
|
export { funGlobal_CheckProfile };
|
||||||
|
|||||||
Reference in New Issue
Block a user