Patch force dynamic route for dashboard/agent

This commit is contained in:
charles-gauthereau
2025-02-21 08:59:37 +01:00
parent b1ecb7ce01
commit 01019fe1a3
3 changed files with 9 additions and 5 deletions
@@ -5,13 +5,17 @@ import {Button} from "@/components/ui/button";
import Link from 'next/link'
import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
import {prisma} from "@/prisma";
import {notFound} from "next/navigation";
export const dynamic = "force-dynamic";
export default async function RoutePage(props: PageParams<{}>) {
const agents = await prisma.agent.findMany({})
const agents = await prisma.agent.findMany()
if(!agents){
notFound()
}
return (
+3 -2
View File
@@ -1,10 +1,11 @@
import React from "react";
import {currentUser} from "@/auth/current-user";
import {currentUser, requiredCurrentUser} from "@/auth/current-user";
import {notFound} from "next/navigation";
export default async function Layout({children}: { children: React.ReactNode }) {
const user = await currentUser()
const user = await requiredCurrentUser()
if(user.role != "admin"){
notFound()
}