redirecting if no game data in state
This commit is contained in:
parent
a8655bbb1e
commit
401b3e850f
|
|
@ -5,12 +5,16 @@ import AnimatedPage from "../components/AnimatedPage";
|
||||||
import { useUser } from "../hooks/useUser";
|
import { useUser } from "../hooks/useUser";
|
||||||
import { useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
import ResultsModals from "../components/results/ResultsModals";
|
import ResultsModals from "../components/results/ResultsModals";
|
||||||
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
export default function Results() {
|
export default function Results() {
|
||||||
const { language, screenTranslations } = useUser();
|
const { language, screenTranslations } = useUser();
|
||||||
// if (!screenTranslations) return <p>loading</p>;
|
// if (!screenTranslations) return <p>loading</p>;
|
||||||
|
|
||||||
let location = useLocation();
|
let location = useLocation();
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
if (!location.state) return navigate("/play");
|
||||||
|
|
||||||
const { contextGameDatas } = location.state;
|
const { contextGameDatas } = location.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user