Fix: Cookies
This commit is contained in:
@@ -6,6 +6,8 @@ import dotenv from "dotenv";
|
||||
import { ServerEnv } from "./lib/server_env";
|
||||
import { RealtimeProvider } from "./lib";
|
||||
import { funGetUserIdByToken } from "@/app_modules/_global/fun/get";
|
||||
import { funCheckCookies } from "@/app_modules/_global/fun/get/fun_check_cookies";
|
||||
import { redirect } from "next/navigation";
|
||||
dotenv.config({
|
||||
path: ".env",
|
||||
});
|
||||
@@ -18,6 +20,8 @@ const Client_KEY = process.env.Client_KEY!;
|
||||
const Server_KEY = process.env.Server_KEY!;
|
||||
const MAPBOX_TOKEN = process.env.MAPBOX_TOKEN!;
|
||||
const WS_APIKEY = process.env.WS_APIKEY!;
|
||||
const NEXT_PUBLIC_WIBU_REALTIME_TOKEN =
|
||||
process.env.NEXT_PUBLIC_WIBU_REALTIME_TOKEN!;
|
||||
|
||||
if (!DATABASE_URL) throw new Error("Require DATABASE_URL");
|
||||
if (!WIBU_PWD) throw new Error("Require WIBU_PWD");
|
||||
@@ -25,6 +29,8 @@ if (!Client_KEY) throw new Error("Require Client_KEY");
|
||||
if (!Server_KEY) throw new Error("Require Server_KEY");
|
||||
if (!MAPBOX_TOKEN) throw new Error("Require MAPBOX_TOKEN");
|
||||
if (!WS_APIKEY) throw new Error("Require WS_APIKEY");
|
||||
if (!NEXT_PUBLIC_WIBU_REALTIME_TOKEN)
|
||||
throw new Error("Require NEXT_PUBLIC_WIBU_REALTIME_TOKEN");
|
||||
|
||||
const envObject = {
|
||||
DATABASE_URL,
|
||||
@@ -33,6 +39,7 @@ const envObject = {
|
||||
Server_KEY,
|
||||
MAPBOX_TOKEN,
|
||||
WS_APIKEY,
|
||||
NEXT_PUBLIC_WIBU_REALTIME_TOKEN,
|
||||
};
|
||||
ServerEnv.set(envObject);
|
||||
|
||||
@@ -41,15 +48,22 @@ export default async function RootLayout({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
// if (!token) return <>Require Token Storage</>;
|
||||
const userLoginId = await funGetUserIdByToken();
|
||||
if (!token) return <>Require Token Storage</>;
|
||||
// const userLoginId = await funGetUserIdByToken();
|
||||
// const WIBU_REALTIME_TOKEN = process.env.NEXT_PUBLIC_WIBU_REALTIME_TOKEN;
|
||||
// console.log(WIBU_REALTIME_TOKEN, "WIBU_REALTIME_TOKEN");
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<RootStyleRegistry>
|
||||
{/* <MqttLoader />
|
||||
<TokenProvider token={token} envObject={envObject} /> */}
|
||||
<RealtimeProvider userLoginId={userLoginId as string} />
|
||||
{/* <MqttLoader /> */}
|
||||
<TokenProvider token={token} envObject={envObject} />
|
||||
{/* <RealtimeProvider
|
||||
userLoginId={userLoginId as string}
|
||||
WIBU_REALTIME_TOKEN={
|
||||
ServerEnv.value?.NEXT_PUBLIC_WIBU_REALTIME_TOKEN as string
|
||||
}
|
||||
/> */}
|
||||
{children}
|
||||
</RootStyleRegistry>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user