☰
@@ -51,12 +50,12 @@ const NavBar = ({ role, email }: UserProps) => {
diff --git a/package-lock.json b/package-lock.json
index ddd9f6d..dee8bcf 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -19,6 +19,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.39.2",
+ "react-icons": "^4.6.0",
"react-markdown": "8.0.3",
"yup": "^0.32.11"
},
@@ -1993,6 +1994,14 @@
"react": "^16.8.0 || ^17 || ^18"
}
},
+ "node_modules/react-icons": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.6.0.tgz",
+ "integrity": "sha512-rR/L9m9340yO8yv1QT1QurxWQvWpbNHqVX0fzMln2HEb9TEIrQRGsqiNFQfiv9/JEUbyHmHPlNTB2LWm2Ttz0g==",
+ "peerDependencies": {
+ "react": "*"
+ }
+ },
"node_modules/react-is": {
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
@@ -3974,6 +3983,12 @@
"integrity": "sha512-rCeCa1+sIcgI9PjgGmev9bVqHCwYwhjkbsXitr+giQ/P0mf/AGwUBtCdKC1lRu7egrxbLwqO9cWNWpXW4FrsHA==",
"requires": {}
},
+ "react-icons": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.6.0.tgz",
+ "integrity": "sha512-rR/L9m9340yO8yv1QT1QurxWQvWpbNHqVX0fzMln2HEb9TEIrQRGsqiNFQfiv9/JEUbyHmHPlNTB2LWm2Ttz0g==",
+ "requires": {}
+ },
"react-is": {
"version": "18.2.0",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",
diff --git a/package.json b/package.json
index 81c633d..3d20ad7 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hook-form": "^7.39.2",
+ "react-icons": "^4.6.0",
"react-markdown": "8.0.3",
"yup": "^0.32.11"
},
diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts
index 04d48d4..a815d9e 100644
--- a/pages/api/auth/[...nextauth].ts
+++ b/pages/api/auth/[...nextauth].ts
@@ -24,4 +24,21 @@ const options = {
],
adapter: PrismaAdapter(prisma),
secret: process.env.SECRET,
+ callbacks: {
+ async session({ session, user }) {
+
+ const getCurrentUser = await prisma.user.findMany({
+ where: { email: session.user.email },
+ })
+ //récupération du role
+ const { role } = getCurrentUser[0];
+
+ session.user.role = role
+
+
+
+ return session
+ }
+ }
+
}
diff --git a/pages/index.tsx b/pages/index.tsx
index 889a7f4..846e351 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -5,7 +5,7 @@ import prisma from '../lib/prisma'
import Image from 'next/image';
import * as Yup from 'yup';
import Head from "next/head";
-import { useSession } from "next-auth/react";
+import { getSession, useSession } from "next-auth/react";
import { yupResolver } from "@hookform/resolvers/yup";
import { useForm } from "react-hook-form";
import Router from "next/router";
@@ -24,6 +24,7 @@ import unAnDeThe from '../public/images/unandethé.png'
import sablier from '../public/images/sablier.png'
import cadeau from '../public/images/cadeau.png'
import jeuConcours from '../public/images/jeuconcours.png'
+import { GetServerSideProps } from "next";
@@ -31,6 +32,7 @@ type CodeSubmitForm = {
codeCadeau: string;
};
+
const MainPage = () => {
const { data: session } = useSession();
@@ -83,82 +85,32 @@ const MainPage = () => {
-