From 790e9e589779c34dad9a743aeeb9c12040be059d Mon Sep 17 00:00:00 2001 From: Alexandre POMMIER Date: Mon, 26 Jun 2023 12:02:50 +0200 Subject: [PATCH] je sais plus --- containers/react/src/components/Messages/Modal.tsx | 1 - containers/react/src/pages/Field.tsx | 14 +++++++++----- containers/react/src/pages/canvas.tsx | 3 +-- containers/react/src/script/tokenSuccess.tsx | 3 +-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/containers/react/src/components/Messages/Modal.tsx b/containers/react/src/components/Messages/Modal.tsx index 54e8cc44..6480f24b 100644 --- a/containers/react/src/components/Messages/Modal.tsx +++ b/containers/react/src/components/Messages/Modal.tsx @@ -129,7 +129,6 @@ const Modal = ({handleClose}: ModalProps) => { members: selectedOptions, } try{ - // test await api.post("/conv", data); handleClose(); window.location.reload(); diff --git a/containers/react/src/pages/Field.tsx b/containers/react/src/pages/Field.tsx index bd242261..7d70b019 100644 --- a/containers/react/src/pages/Field.tsx +++ b/containers/react/src/pages/Field.tsx @@ -16,6 +16,7 @@ function Field() useEffect(() => { const queryParams = queryString.parse(window.location.search); + console.log("launch canva hehe") let Modifiers = 0; let info: GameProps; @@ -37,16 +38,19 @@ function Field() } if (queryParams.username) { - info = { - privateParty: true, - username: queryParams.username as string, - gameId: queryParams.gameId as unknown as number - } + console.log("user= ", queryParams.username) + info = { + privateParty: true, + username: queryParams.username as string, + gameId: queryParams.gameId as unknown as number + } + console.log("info of param vefore canvas=", info) } const cleanup = DrawCanvas(Modifiers, info); return () => { + console.log("Cleanup"); if (cleanup) cleanup(); }; diff --git a/containers/react/src/pages/canvas.tsx b/containers/react/src/pages/canvas.tsx index d60eb414..cd63fe12 100644 --- a/containers/react/src/pages/canvas.tsx +++ b/containers/react/src/pages/canvas.tsx @@ -10,7 +10,6 @@ interface GameProps { function DrawCanvas(option: number, gameParam: GameProps) { - useEffect(() => { const handleBeforeUnload = async (event: { preventDefault: () => void; returnValue: string; }) => { try { @@ -19,13 +18,13 @@ function DrawCanvas(option: number, gameParam: GameProps) { console.log(err); } }; - window.addEventListener('beforeunload', handleBeforeUnload); return () => { window.removeEventListener('beforeunload', handleBeforeUnload); }; }, []); + console.log(`option= ${option}`); const superpowerModifier = option & 1; // Retrieves the superpower modifier const obstacleModifier = (option >> 1) & 1; // Retrieves the obstacle modifier diff --git a/containers/react/src/script/tokenSuccess.tsx b/containers/react/src/script/tokenSuccess.tsx index 7b0f7ec0..2a6faecd 100644 --- a/containers/react/src/script/tokenSuccess.tsx +++ b/containers/react/src/script/tokenSuccess.tsx @@ -1,11 +1,10 @@ import { useLocation } from 'react-router-dom'; import { useState, useEffect } from 'react' import queryString from 'query-string'; -import api from "./axiosApi.tsx"; import axios from 'axios'; import React from 'react'; -import {Matchlog, User} from "../../interfaces.tsx" +import {User} from "../../interfaces.tsx" function SuccessToken() { const location = useLocation();