mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
test: auth page
This commit is contained in:
parent
bf60403111
commit
01ab91976d
@ -1,16 +1,18 @@
|
|||||||
import Footer from "@/app/[locale]/(main)/footer";
|
import Footer from "@/app/[locale]/(main)/footer";
|
||||||
import Header from "@/app/[locale]/(main)/header";
|
import Header from "@/app/[locale]/(main)/header";
|
||||||
import { auth } from "@/auth";
|
import { auth } from "@/auth";
|
||||||
import { SignIn } from "@/components/sign-in";
|
|
||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { redirect } from "next/navigation";
|
||||||
|
|
||||||
type DashboardProps = {
|
type DashboardProps = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
export default async function MainLayout({ children }: DashboardProps) {
|
export default async function MainLayout({ children }: DashboardProps) {
|
||||||
const session = await auth()
|
const session = await auth()
|
||||||
if (!session && getEnv("SITE_PASSWORD")) return <SignIn />
|
if (!session && getEnv("SITE_PASSWORD")) {
|
||||||
|
redirect("/api/auth/signin");
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex min-h-screen w-full flex-col">
|
<div className="flex min-h-screen w-full flex-col">
|
||||||
|
Loading…
Reference in New Issue
Block a user