main page overhaul

This commit is contained in:
2023-03-22 15:29:20 +01:00
parent 876333edd5
commit fd379ec491
9 changed files with 95 additions and 23 deletions

View File

@@ -0,0 +1,33 @@
import useTitle from "../../utils/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');
const [rooms, setRooms] = React.useState<string[]>([]);
React.useEffect(() => {
fetch(ROOM_URL)
.then(r => r.json())
.then(data => setRooms(data));
}, []);
return (
<div>
<h1>Rooms</h1>
<ul>
{
rooms.map((room, index) => {
return <li key={index}><Link to={`room/${room}`}>{room}</Link></li>
})
}
</ul>
</div>
);
};
export default Rooms;