fixed navigation links

This commit is contained in:
2023-04-07 11:17:50 +02:00
parent 2eb05585f1
commit 10ccc2ee7c
3 changed files with 12 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
import useWebSocket from "react-use-websocket";
import React from "react";
import {useParams} from "react-router";
import {useNavigate, useParams} from "react-router";
import {GHButton} from "../components/Button";
import useTitle from "../../utils/hooks/TitleHook";
import Hand from "../components/Hand";
@@ -18,6 +18,8 @@ const Room = () => {
useTitle('Mau!');
const navigateTo = useNavigate();
const {roomId} = useParams();
const WS_URL = `ws://${process.env.REACT_APP_API_URL}/room/${roomId}`;
@@ -43,7 +45,7 @@ const Room = () => {
const handleLeaveRoom = () => {
const socket = websocket.getWebSocket();
if (socket) socket.close();
window.location.href = '/';
navigateTo('/');
}
const handleCardSend = (card: string) => {