fixed url
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user