= ({roomNum, HeadPlayer, nbP
if (nbPlayer < 6 && !started) {
socket.off("request lobbies")
setFirst(true)
- navigate(dest);
+ navigate(`${basePath}/${dest}`);
}
else if(started){
handleShowStart()
diff --git a/cryptide_project/src/Components/NavBar.tsx b/cryptide_project/src/Components/NavBar.tsx
index 5b0753f..5921026 100644
--- a/cryptide_project/src/Components/NavBar.tsx
+++ b/cryptide_project/src/Components/NavBar.tsx
@@ -25,6 +25,9 @@ import { useTheme } from '../Style/ThemeContext';
import { useAuth } from '../Contexts/AuthContext';
import { useNavigate } from 'react-router-dom';
+const basePath = process.env.REACT_APP_BASE_PATH || '';
+
+
// @ts-ignore
function AppNavbar({changeLocale}) {
const theme = useTheme();
@@ -34,11 +37,11 @@ function AppNavbar({changeLocale}) {
function navigateToProfile(){
- navigate("/profile")
+ navigate(`${basePath}/profile`)
}
function navigateToHome(){
- navigate("/")
+ navigate(`${basePath}/`)
}
return (
diff --git a/cryptide_project/src/Error/ErrorPage.tsx b/cryptide_project/src/Error/ErrorPage.tsx
index 464c99b..dc3da66 100644
--- a/cryptide_project/src/Error/ErrorPage.tsx
+++ b/cryptide_project/src/Error/ErrorPage.tsx
@@ -6,6 +6,7 @@ import './ErrorStyle.css';
import { FormattedMessage } from 'react-intl';
import { Button } from 'react-bootstrap';
+const basePath = process.env.REACT_APP_BASE_PATH || '';
//@ts-ignore
@@ -28,7 +29,7 @@ function ErrorPage({ code = "", msg = "Something is wrong"}) {
-
+
);
diff --git a/cryptide_project/src/Pages/InGame.tsx b/cryptide_project/src/Pages/InGame.tsx
index f90c73f..9b20931 100644
--- a/cryptide_project/src/Pages/InGame.tsx
+++ b/cryptide_project/src/Pages/InGame.tsx
@@ -52,6 +52,8 @@ import Indice from '../model/Indices/Indice';
let cptNavigation = 0
+const basePath = process.env.REACT_APP_BASE_PATH || '';
+
//@ts-ignore
const InGame = ({locale, changeLocale}) => {
@@ -66,7 +68,7 @@ const InGame = ({locale, changeLocale}) => {
if (cptNavigation % 2 == 0){
if (navigationType.toString() == "POP"){
socket.emit("player quit")
- navigate("/play")
+ navigate(`${basePath}/play`)
}
}
diff --git a/cryptide_project/src/Pages/Lobby.tsx b/cryptide_project/src/Pages/Lobby.tsx
index 60419ad..572c36a 100644
--- a/cryptide_project/src/Pages/Lobby.tsx
+++ b/cryptide_project/src/Pages/Lobby.tsx
@@ -50,6 +50,8 @@ import { DataSet } from 'vis-network';
let gameStarted = false
let firstLaunch = true
+const basePath = process.env.REACT_APP_BASE_PATH || '';
+
function Lobby() {
const theme=useTheme();
@@ -134,7 +136,7 @@ function Lobby() {
gameStarted = true
//socket.off("player left")
//socket.off("new player")
- navigate('/game?solo=false&daily=false');
+ navigate(`${basePath}/game?solo=false&daily=false`);
});
@@ -170,7 +172,7 @@ function Lobby() {
setIndicesData(choosenIndices)
first = true
gameStarted = true
- navigate('/game?solo=false&daily=false');
+ navigate(`${basePath}/game?solo=false&daily=false`)
});
socket.on("new player", (tab) =>{
@@ -185,17 +187,17 @@ function Lobby() {
socket.on("room full", () => {
//TODO POP UP pour quand la room est pleine
- navigate("/play")
+ navigate(`${basePath}/play`)
})
socket.on("game started", () => {
//TODO POP UP pour quand la room est pleine
- navigate("/play")
+ navigate(`${basePath}/play`)
})
socket.on("game already started", () => {
//TODO POP UP pour quand la room est pleine
- navigate("/play")
+ navigate(`${basePath}/play`)
})
socket.on("player left", (tab, i) => {
diff --git a/cryptide_project/src/Pages/LoginForm.tsx b/cryptide_project/src/Pages/LoginForm.tsx
index 0f650a3..dde8427 100644
--- a/cryptide_project/src/Pages/LoginForm.tsx
+++ b/cryptide_project/src/Pages/LoginForm.tsx
@@ -5,6 +5,8 @@ import { useAuth } from '../Contexts/AuthContext';
import AuthService from '../services/AuthService';
import '../Style/Global.css';
+const basePath = process.env.REACT_APP_BASE_PATH || '';
+
const SignIn = () => {
const navigate = useNavigate();
const { login } = useAuth();
@@ -35,7 +37,7 @@ const SignIn = () => {
setShowConfirmation(true);
setTimeout(async () => {
await login();
- navigate('/');
+ navigate(`${basePath}/`);
}, 1250);
}
} catch (error: any) {
diff --git a/cryptide_project/src/Pages/NewPlay.tsx b/cryptide_project/src/Pages/NewPlay.tsx
index 6af04e3..8c658f1 100644
--- a/cryptide_project/src/Pages/NewPlay.tsx
+++ b/cryptide_project/src/Pages/NewPlay.tsx
@@ -34,6 +34,9 @@ import Lobbies from './Lobbies';
let cptNavigation = 0
+const basePath = process.env.REACT_APP_BASE_PATH || '';
+
+
function NewPlay() {
let first = true
@@ -97,7 +100,7 @@ function NewPlay() {
setPersonNetworkData(networkPerson)
setIndicesData(choosenIndices)
setIndicesData(choosenIndices)
- navigate('/game?solo=true&daily=false');
+ navigate(`${basePath}/game?solo=true&daily=false`);
}
@@ -128,12 +131,12 @@ function NewPlay() {
useEffect(() => {
if (room !== null) {
const nouvelleURL = `/lobby?room=${room}`;
- navigate(nouvelleURL);
+ navigate(`${basePath}${nouvelleURL}`)
}
}, [room, navigate]);
const goBack = () => {
- navigate("/lobby?room=" + goBackRoom)
+ navigate(`${basePath}/lobby?room=${goBackRoom}`)
}
@@ -156,7 +159,7 @@ function NewPlay() {
setIndicesData(choosenIndices)
setIndicesData(choosenIndices)
- navigate('/game?solo=true&daily=true&easy=true');
+ navigate(`${basePath}/game?solo=true&daily=true&easy=true`);
setShowOverlay(false);
};
@@ -174,7 +177,7 @@ function NewPlay() {
const map = EnigmeDuJourCreator.createEnigme(networkPerson, choosenIndices, choosenPerson, Stub.GenerateIndice())
setDailyEnigmeData(map)
}
- navigate('/game?solo=true&daily=true&easy=false');
+ navigate(`${basePath}/game?solo=true&daily=true&easy=false`);
setShowOverlay(false);
};
diff --git a/cryptide_project/src/Pages/Play.tsx b/cryptide_project/src/Pages/Play.tsx
index 00e35ee..e783f53 100644
--- a/cryptide_project/src/Pages/Play.tsx
+++ b/cryptide_project/src/Pages/Play.tsx
@@ -32,6 +32,8 @@ import Info from '../res/icon/infoGreen.png';
let cptNavigation = 0
+const basePath = process.env.REACT_APP_BASE_PATH || '';
+
function Play() {
let first = true
@@ -98,7 +100,7 @@ function Play() {
setPersonNetworkData(networkPerson)
setIndicesData(choosenIndices)
setIndicesData(choosenIndices)
- navigate('/game?solo=true&daily=false');
+ navigate(`${basePath}/game?solo=true&daily=false`);
}
@@ -129,12 +131,12 @@ function Play() {
useEffect(() => {
if (room !== null) {
const nouvelleURL = `/lobby?room=${room}`;
- navigate(nouvelleURL);
+ navigate(`${basePath}${nouvelleURL}`);
}
}, [room, navigate]);
const goBack = () => {
- navigate("/lobby?room=" + goBackRoom)
+ navigate(`${basePath}/lobby?room=${goBackRoom}`)
}
@@ -157,7 +159,7 @@ function Play() {
setIndicesData(choosenIndices)
setIndicesData(choosenIndices)
- navigate('/game?solo=true&daily=true&easy=true');
+ navigate(`${basePath}/game?solo=true&daily=true&easy=true`);
setShowOverlay(false);
};
@@ -175,7 +177,7 @@ function Play() {
const map = EnigmeDuJourCreator.createEnigme(networkPerson, choosenIndices, choosenPerson, Stub.GenerateIndice())
setDailyEnigmeData(map)
}
- navigate('/game?solo=true&daily=true&easy=false');
+ navigate(`${basePath}/game?solo=true&daily=true&easy=false`);
setShowOverlay(false);
};
@@ -238,7 +240,7 @@ function Play() {
-
+
diff --git a/cryptide_project/src/Pages/Profile.tsx b/cryptide_project/src/Pages/Profile.tsx
index 5b0a634..a59ad2e 100644
--- a/cryptide_project/src/Pages/Profile.tsx
+++ b/cryptide_project/src/Pages/Profile.tsx
@@ -25,6 +25,8 @@ import Form from 'react-bootstrap/Form';
import ProgressBar from 'react-bootstrap/ProgressBar';
+const basePath = process.env.REACT_APP_BASE_PATH || '';
+
//@ts-ignore
const Profile = () => {
@@ -184,7 +186,7 @@ const Profile = () => {
}
handleCloseDeleteModal();
- navigate("/")
+ navigate(`${basePath}/`)
} else {
console.error('Phrase de confirmation incorrecte.');
diff --git a/cryptide_project/src/Pages/SignUpForm.tsx b/cryptide_project/src/Pages/SignUpForm.tsx
index e7b6025..9e29449 100644
--- a/cryptide_project/src/Pages/SignUpForm.tsx
+++ b/cryptide_project/src/Pages/SignUpForm.tsx
@@ -4,6 +4,9 @@ import { useNavigate } from 'react-router-dom';
import AuthService from '../services/AuthService';
import '../Style/Global.css';
+const basePath = process.env.REACT_APP_BASE_PATH || '';
+
+
const SignUp = () => {
const navigate = useNavigate();
@@ -32,7 +35,7 @@ const SignUp = () => {
setShowConfirmation(true);
setTimeout(() => {
- navigate('/login'); // 3 secondes avant de rediriger vers la page de connexion
+ navigate(`${basePath}/login`); // 3 secondes avant de rediriger vers la page de connexion
}, 1250);
}
} catch (error: any) {