fix admin redirect loop
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
import { isAdmin } from '~/app/actions'
|
||||
import { redirect } from 'next/navigation'
|
||||
import { servTrpc } from '~/app/_trpc/ServerClient'
|
||||
import SystemPromptForm from './_components/SystemPromptForm'
|
||||
|
||||
export default async function SystemPromptPage() {
|
||||
if (!(await isAdmin())) redirect('/admin')
|
||||
|
||||
const prompt = await servTrpc.chat.getSystemPrompt()
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { isAdmin } from "~/app/actions";
|
||||
import { SidebarProvider } from "~/components/ui/sidebar";
|
||||
import AdminSideBar from "./_components/AdminSideBar";
|
||||
import { ScrollArea } from "~/components/ui/scroll-area";
|
||||
|
||||
export const dynamic = 'force-dynamic';
|
||||
|
||||
export default function Admin({children}: Readonly<{children: React.ReactNode}>) {
|
||||
export default async function Admin({children}: Readonly<{children: React.ReactNode}>) {
|
||||
if (!(await isAdmin())) redirect("/");
|
||||
|
||||
return (
|
||||
<>
|
||||
<SidebarProvider>
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
'use server'
|
||||
|
||||
import { Show } from "@clerk/nextjs";
|
||||
|
||||
export default async function AdminPage() {
|
||||
return (
|
||||
<Show when="signed-in">
|
||||
<main className="flex min-h-screen flex-col items-center justify-center">
|
||||
<div>
|
||||
hello admin
|
||||
</div>
|
||||
</main>
|
||||
</Show>
|
||||
<main className="flex min-h-screen flex-col items-center justify-center">
|
||||
<div>
|
||||
hello admin
|
||||
</div>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user