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 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 <SignIn />
|
||||
if (!session && getEnv("SITE_PASSWORD")) {
|
||||
redirect("/api/auth/signin");
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen w-full flex-col">
|
||||
|
Loading…
Reference in New Issue
Block a user