From 7747467a3053f48471107d6433166347cb51b221 Mon Sep 17 00:00:00 2001 From: Alexandre78R Date: Tue, 17 Jun 2025 21:04:37 +0200 Subject: [PATCH] fixed staging test dev --- docker-compose.yml | 2 -- frontend/Dockerfile | 6 +++--- frontend/src/context/UserContext/UserContext.tsx | 3 ++- frontend/src/pages/admin/auth/login.tsx | 10 ++++++---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 593248ce..b9b67ad2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,8 +34,6 @@ services: - NEXT_PUBLIC_IMAGE_URL=http://localhost:8000 - NEXT_PUBLIC_API_TOKEN=${NEXT_PUBLIC_API_TOKEN} - NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} - - NEXT_PUBLIC_JWT_SECRET=${NEXT_PUBLIC_JWT_SECRET} - - JWT_SECRET=${JWT_SECRET} - API_URL=${API_URL} - NODE_ENV=development env_file: diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 66e4a195..56179eab 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -23,10 +23,10 @@ ENV NEXT_PUBLIC_JWT_SECRET=${NEXT_PUBLIC_JWT_SECRET} ARG JWT_SECRET ENV JWT_SECRET=${JWT_SECRET} -CMD npm run dev +# CMD npm run dev -# RUN npm run build -# CMD npm run start +RUN npm run build +CMD npm run start # RUN if [ "$NODE_ENV" = "production" ]; then npm run build; fi # CMD if [ "$NODE_ENV" = "production" ]; then npm run start; else npm run dev; fi \ No newline at end of file diff --git a/frontend/src/context/UserContext/UserContext.tsx b/frontend/src/context/UserContext/UserContext.tsx index 2ccebd51..67f24415 100644 --- a/frontend/src/context/UserContext/UserContext.tsx +++ b/frontend/src/context/UserContext/UserContext.tsx @@ -24,7 +24,8 @@ export const UserProvider = ({ children }: { children: ReactNode }) => { const [user, setUser] = useState(null); useEffect(() => { - console.log("data", data) + console.log("data", data); + if (data?.me) { setUser(data.me); } else { diff --git a/frontend/src/pages/admin/auth/login.tsx b/frontend/src/pages/admin/auth/login.tsx index d9964962..4da5a9fe 100644 --- a/frontend/src/pages/admin/auth/login.tsx +++ b/frontend/src/pages/admin/auth/login.tsx @@ -44,6 +44,8 @@ const LoginPage = (): React.ReactElement => { const handleLogin = async (e: FormEvent) => { e.preventDefault(); + console.log("varible NEXT_PUBLIC_JWT_SECRET -->", process.env.NEXT_PUBLIC_JWT_SECRET); + try { const res = await login({ variables: { @@ -57,16 +59,16 @@ const LoginPage = (): React.ReactElement => { const response = res.data?.login; if (response?.code === 200) { - // console.log("✅ Connexion réussie :", response.message); + console.log("✅ Connexion réussie :", response.message); showAlert("success", translations.messagePageLoginMessageSuccess); } else if (response?.code === 401) { - // console.warn("❌ Identifiants invalides :", response.message); + console.warn("❌ Identifiants invalides :", response.message); showAlert("error", translations.messagePageLoginMessageErrorServer); } else if (response?.code === 500) { - // console.error("❌ Erreur serveur :", response.message); + console.error("❌ Erreur serveur :", response.message); showAlert("error", translations.messagePageLoginMessageErrorUnexpected); } else { - // console.warn("⚠️ Autre erreur :", response?.message); + console.warn("⚠️ Autre erreur :", response?.message); showAlert("error", translations.messagePageLoginMessageErrorServer); } } catch (err) {