From 27dbf59c8557c7a356c586dc380f9e010e48a313 Mon Sep 17 00:00:00 2001 From: Florian Trayon <26360935+FlorianLeChat@users.noreply.github.com> Date: Mon, 30 Jan 2023 22:25:42 +0100 Subject: [PATCH] Fixed 404 error display on unauthorized pages --- client/next.config.js | 2 +- client/pages/game/selection.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/next.config.js b/client/next.config.js index 18ba429..c630f5c 100644 --- a/client/next.config.js +++ b/client/next.config.js @@ -23,5 +23,5 @@ module.exports = { destination: "https://github.com/FlorianLeChat/Domego" }, ]; - }, + } }; \ No newline at end of file diff --git a/client/pages/game/selection.tsx b/client/pages/game/selection.tsx index aa44d8c..d0a9448 100644 --- a/client/pages/game/selection.tsx +++ b/client/pages/game/selection.tsx @@ -3,6 +3,7 @@ // import dynamic from "next/dynamic"; import { useRouter } from "next/router"; +import DefaultErrorPage from "next/error"; import { GetStaticProps } from "next"; import { useTranslation } from "next-i18next"; import Swal, { SweetAlertIcon } from "sweetalert2"; @@ -10,7 +11,6 @@ import { serverSideTranslations } from "next-i18next/serverSideTranslations"; import { useContext, useState, useEffect, Suspense } from "react"; import styles from "@/styles/RoleSelection.module.scss"; -import NotFound from "@/components/NotFound"; import i18nextConfig from "@/next-i18next.config"; import { SocketContext } from "@/utils/SocketContext"; @@ -108,12 +108,12 @@ export default function RoleSelection() { setDisabled( !state ); } ); - }, [ t, router, socket, location ] ); + }, [ t, router, socket ] ); // Vérification de la connexion à la partie. - if ( !socket.connected || location === null ) + if ( !socket.connected || !router.query ) { - return ; + return ; } // Affichage du rendu HTML du composant.