mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-19 07:23:46 +08:00
fix bug edge runtime
This commit is contained in:
@@ -3,12 +3,23 @@ import { Metadata } from "next";
|
||||
import { ReactNode } from "react";
|
||||
import { AntdRegistry } from "@ant-design/nextjs-registry";
|
||||
// import Head from "next/head";
|
||||
import { VerifiedAdminUser, VerifiedUser } from "@/lib/auth";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Admin | 管理页面",
|
||||
};
|
||||
|
||||
export default function AdminLayout({ children }: { children: ReactNode }) {
|
||||
export default async function AdminLayout({
|
||||
children,
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const isAdmin = await VerifiedAdminUser();
|
||||
if (!isAdmin) {
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<AntdRegistry>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import "@/app/app/login.scss";
|
||||
import { Metadata } from "next";
|
||||
import { ReactNode } from "react";
|
||||
// import { VerifiedUser } from "@/lib/auth";
|
||||
// import { redirect } from "next/navigation";
|
||||
import { VerifiedUser } from "@/lib/auth";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Login | 实人认证",
|
||||
@@ -13,11 +13,11 @@ export default async function AuthLayout({
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
// const isUser = await VerifiedUser();
|
||||
// if (isUser) {
|
||||
// // Replace '/dashboard' with the desired redirect path
|
||||
// redirect("/");
|
||||
// }
|
||||
const isUser = await VerifiedUser();
|
||||
if (isUser) {
|
||||
// Replace '/dashboard' with the desired redirect path
|
||||
redirect("/");
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="container1 w-full signin">
|
||||
|
||||
Reference in New Issue
Block a user