add admin link above header

This commit is contained in:
Janis
2023-01-19 11:03:17 +01:00
parent 65eab1f95e
commit e048fc5d17

View File

@@ -6,6 +6,7 @@ import Footer from "./Footer";
import { Category } from "@prisma/client"; import { Category } from "@prisma/client";
import urlJoin from "url-join"; import urlJoin from "url-join";
import { apiUrl } from "./global"; import { apiUrl } from "./global";
import Link from "next/link";
async function getCategories(): Promise<Category[]> { async function getCategories(): Promise<Category[]> {
const result: Response = await fetch(urlJoin(apiUrl, `categories`), { const result: Response = await fetch(urlJoin(apiUrl, `categories`), {
@@ -22,7 +23,9 @@ export default async function RootLayout({ children }: { children: React.ReactNo
<head></head> <head></head>
<body className="body"> <body className="body">
<p>If admin logged in create a small header here app/layout.tsx</p> <div>
<Link href={"/admin"}> Admin</Link>
</div>
<header> <header>
<Nav categories={await getCategories()} /> <Nav categories={await getCategories()} />
</header> </header>