Merge pull request #133 from bipproduction/cookies/fix

Fix: Middlerawe/2
This commit is contained in:
Bagasbanuna02
2024-11-21 15:21:09 +08:00
committed by GitHub
3 changed files with 7 additions and 13 deletions

View File

@@ -4,7 +4,8 @@ import { CheckCookies_UiLayout } from "@/app_modules/check_cookies";
export default function Layout({ children }: { children: React.ReactNode }) { export default function Layout({ children }: { children: React.ReactNode }) {
return ( return (
<> <>
<CheckCookies_UiLayout>{children}</CheckCookies_UiLayout> {children}
{/* <CheckCookies_UiLayout>{children}</CheckCookies_UiLayout> */}
</> </>
); );
} }

View File

@@ -41,15 +41,14 @@ export default async function RootLayout({
}: { }: {
children: React.ReactNode; children: React.ReactNode;
}) { }) {
const userLoginId = await funGetUserIdByToken(); // if (!token) return <>Require Token Storage</>;
// const userLoginId = await funGetUserIdByToken();
if (!token) return <>Require Token Storage</>;
return ( return (
<RootStyleRegistry> <RootStyleRegistry>
{/* <MqttLoader /> {/* <MqttLoader />
<TokenProvider token={token} envObject={envObject} /> */} <TokenProvider token={token} envObject={envObject} /> */}
<RealtimeProvider userLoginId={userLoginId as string} /> {/* <RealtimeProvider userLoginId={userLoginId as string} /> */}
{children} {children}
</RootStyleRegistry> </RootStyleRegistry>
); );

View File

@@ -12,16 +12,10 @@ export function middleware(request: NextRequest) {
_.isEmpty(cookies?.value) || _.isEmpty(cookies?.value) ||
_.isUndefined(cookies?.value) _.isUndefined(cookies?.value)
) { ) {
return NextResponse.redirect(new URL("/", request.url)); return NextResponse.redirect(new URL("/dev/auth/login", request.url));
}
} }
// return NextResponse.redirect(new URL("/", request.url));
}
// See "Matching Paths" below to learn more
export const config = { export const config = {
matcher: [ matcher: ["/((?!_next|static|favicon.ico|manifest).*)"],
"/((?!_next|static|favicon.ico|manifest).*)",
],
}; };