mirror of
				https://github.com/DerTyp7/explainegy-nextjs.git
				synced 2025-10-31 05:37:12 +01:00 
			
		
		
		
	auth
This commit is contained in:
		| @@ -1,14 +1,21 @@ | ||||
| import React from "react"; | ||||
| import Link from "next/link"; | ||||
| import styles from "@/styles/modules/AdminNav.module.scss"; | ||||
| import { useSession } from "next-auth/react"; | ||||
| import { redirect, useRouter } from "next/navigation"; | ||||
|  | ||||
| function AdminNav() { | ||||
|   return ( | ||||
|     <div className={styles.adminNav}> | ||||
|       <Link href={"/admin/editor/article/0"}>New article</Link> | ||||
|       <Link href={"/admin/editor/category/0"}>New category</Link> | ||||
|     </div> | ||||
|   ); | ||||
|   const { data: session } = useSession(); | ||||
|  | ||||
|   if (session) { | ||||
|     return ( | ||||
|       <div className={styles.adminNav}> | ||||
|         <Link href={"/admin/editor/article/0"}>New article</Link> | ||||
|         <Link href={"/admin/editor/category/0"}>New category</Link> | ||||
|         <Link href={"/api/auth/signout"}>Logout</Link> | ||||
|       </div> | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| export default AdminNav; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Janis
					Janis