From f8308254ae0a4e8184a62dc0426f2b2f3d1e022c Mon Sep 17 00:00:00 2001 From: Laurian-Dufrechou Date: Sat, 20 May 2023 19:38:10 +0200 Subject: [PATCH] fix(admin and normal user): admin and normal user --- src/pages/graphique.tsx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/pages/graphique.tsx b/src/pages/graphique.tsx index a5b650b..0678a54 100644 --- a/src/pages/graphique.tsx +++ b/src/pages/graphique.tsx @@ -8,19 +8,29 @@ import LineChart from "@/components/graph/LineChart"; import { Box } from "@chakra-ui/react"; import { websiteName } from "@/lib/constants"; import { useRef, useEffect } from "react"; +import { useSession } from "next-auth/react"; +import type { Session } from "@/models/auth/Session"; +import { Role } from "@prisma/client"; export default function Graphique() { + const { data: session, status } = useSession({ required: true }); + const { user } = session as unknown as Session; return ( <> {websiteName} - - - {/* */} - {/* */} - - + {user.role === Role.ADMIN ? ( + + + + + + ) : ( + // pour récupérer les notifs d'un user + //fetch(`/api/users/${user.id}?include=Notification`) + <> + )} ); }