fixed url

This commit is contained in:
2023-03-24 18:51:14 +01:00
parent 8ce76902a5
commit 2eb05585f1
4 changed files with 12 additions and 10 deletions

View File

@@ -1,12 +1,11 @@
import useTitle from "../../utils/hooks/TitleHook";
import React from "react";
import {Link} from "react-router-dom";
const ROOM_URL = `http://${process.env.REACT_APP_API_URL}/room`;
const Rooms = () => {
useTitle('Rooms');
useTitle('Mau-Mau Rooms');
const [rooms, setRooms] = React.useState<string[]>([]);
@@ -16,13 +15,18 @@ const Rooms = () => {
.then(data => setRooms(data));
}, []);
const gotoRoom = (room: string) => {
window.location.host = `/room/${room}`;
}
return (
<div>
<h1>Rooms</h1>
<ul>
{
rooms.map((room, index) => {
return <li key={index}><Link to={`room/${room}`}>{room}</Link></li>
return <li key={index} className={"clickable"}
onClick={() => gotoRoom(room)}>{room}</li>
})
}
</ul>