Modification win.loc to navigateTO()

This commit is contained in:
NigeParis 2026-01-13 15:48:54 +01:00 committed by Maix0
parent b49641d71c
commit ca1865b850
3 changed files with 13 additions and 6 deletions

View file

@ -9,6 +9,7 @@ import type {
import type { User } from "@app/auth"; import type { User } from "@app/auth";
import { import {
addRoute, addRoute,
navigateTo,
setTitle, setTitle,
type RouteHandlerParams, type RouteHandlerParams,
type RouteHandlerReturn, type RouteHandlerReturn,
@ -312,14 +313,14 @@ sendButton?.addEventListener("click", () => {
case "@pong": case "@pong":
if (msgCommand[1] === "") { if (msgCommand[1] === "") {
window.location.href = "/app/pong/games"; navigateTo("/app/pong/games");
quitChat(); quitChat();
} }
break; break;
case "@ttt": case "@ttt":
if (msgCommand[1] === "") { if (msgCommand[1] === "") {
window.location.href = "/app/ttt/games"; navigateTo("/app/ttt/games");
quitChat(); quitChat();
} }
break; break;
@ -432,12 +433,12 @@ bquit?.addEventListener("click", () => {
}); });
myGames?.addEventListener("click", () => { myGames?.addEventListener("click", () => {
window.location.href = "/app/pong/games"; navigateTo("/app/pong/games");
quitChat(); quitChat();
}); });
myTTTGames?.addEventListener("click", () => { myTTTGames?.addEventListener("click", () => {
window.location.href = "/app/ttt/games"; navigateTo("/app/ttt/games");
quitChat(); quitChat();
}); });

View file

@ -1,5 +1,7 @@
import { navigateTo } from "@app/routing";
import type { ClientProfil } from "../types_front"; import type { ClientProfil } from "../types_front";
import { Socket } from "socket.io-client"; import { Socket } from "socket.io-client";
import { quitChat } from "./quitChat";
/** /**
* function listens for a click on the Pong Games history button * function listens for a click on the Pong Games history button
@ -11,7 +13,8 @@ export function actionBtnPongGames(profile: ClientProfil, senderSocket: Socket)
setTimeout(() => { setTimeout(() => {
const userGames = document.querySelector("#popup-b-hGame"); const userGames = document.querySelector("#popup-b-hGame");
userGames?.addEventListener("click", () => { userGames?.addEventListener("click", () => {
window.location.href = `/app/pong/games/${profile.userID}`; navigateTo(`/app/pong/games/${profile.userID}`);
quitChat();
}); });
}, 0) }, 0)
}; };

View file

@ -1,5 +1,7 @@
import { navigateTo } from "@app/routing";
import type { ClientProfil } from "../types_front"; import type { ClientProfil } from "../types_front";
import { Socket } from "socket.io-client"; import { Socket } from "socket.io-client";
import { quitChat } from "./quitChat";
/** /**
* function listens for a click on the TTT game History button * function listens for a click on the TTT game History button
@ -11,7 +13,8 @@ export function actionBtnTTTGames(profile: ClientProfil, senderSocket: Socket) {
setTimeout(() => { setTimeout(() => {
const userGames = document.querySelector("#popup-b-hTGame"); const userGames = document.querySelector("#popup-b-hTGame");
userGames?.addEventListener("click", () => { userGames?.addEventListener("click", () => {
window.location.href = `/app/ttt/games/${profile.userID}`; navigateTo(`/app/ttt/games/${profile.userID}`);
quitChat();
}); });
}, 0) }, 0)
}; };