From 01ab91976df8230c20be79510a74a9fa9cd9293d Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Mon, 21 Oct 2024 01:27:46 +0800 Subject: [PATCH] test: auth page --- app/[locale]/(main)/layout.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/[locale]/(main)/layout.tsx b/app/[locale]/(main)/layout.tsx index 82a15af..3991299 100644 --- a/app/[locale]/(main)/layout.tsx +++ b/app/[locale]/(main)/layout.tsx @@ -1,16 +1,18 @@ import Footer from "@/app/[locale]/(main)/footer"; import Header from "@/app/[locale]/(main)/header"; import { auth } from "@/auth"; -import { SignIn } from "@/components/sign-in"; import getEnv from "@/lib/env-entry"; import React from "react"; +import { redirect } from "next/navigation"; type DashboardProps = { children: React.ReactNode; }; export default async function MainLayout({ children }: DashboardProps) { const session = await auth() - if (!session && getEnv("SITE_PASSWORD")) return + if (!session && getEnv("SITE_PASSWORD")) { + redirect("/api/auth/signin"); + } return (