Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Fixed 404 error display on unauthorized pages
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianLeChat committed Jan 30, 2023
1 parent 0f7c5d0 commit 27dbf59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/next.config.js
Expand Up @@ -23,5 +23,5 @@ module.exports = {
destination: "https://github.com/FlorianLeChat/Domego"
},
];
},
}
};
8 changes: 4 additions & 4 deletions client/pages/game/selection.tsx
Expand Up @@ -3,14 +3,14 @@
//
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";
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";

Expand Down Expand Up @@ -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 <NotFound />;
return <DefaultErrorPage statusCode={404} />;
}

// Affichage du rendu HTML du composant.
Expand Down

0 comments on commit 27dbf59

Please sign in to comment.