fixed url
This commit is contained in:
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -4,11 +4,9 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- mauster
|
||||
- developmaunt
|
||||
pull_request:
|
||||
branches:
|
||||
- mauster
|
||||
- developmaunt
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta name="description" content="Web site created using create-react-app"/>
|
||||
<meta name="description" content="Mau-Mau!"/>
|
||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<title>React App</title>
|
||||
<title>Mau-Mau</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
|
||||
@@ -6,7 +6,7 @@ const ROOM_URL = `http://${process.env.REACT_APP_API_URL}/room`;
|
||||
|
||||
const MainLobby = () => {
|
||||
|
||||
useTitle('MauLobby');
|
||||
useTitle('Mau-Mau Lobby');
|
||||
|
||||
const handleCreateRoom = () => {
|
||||
fetch(ROOM_URL, {
|
||||
@@ -17,12 +17,12 @@ const MainLobby = () => {
|
||||
}
|
||||
|
||||
const gotoRooms = () => {
|
||||
window.location.href = '/rooms';
|
||||
window.location.host = '/rooms';
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={"main-lobby"}>
|
||||
<h1 className={"main-lobby__title mau"}>MauMau</h1>
|
||||
<h1 className={"main-lobby__title mau"}>Mau-Mau</h1>
|
||||
<div className={"main-lobby__container"}>
|
||||
<div className={"main-lobby__container-button clickable"} onClick={handleCreateRoom}>
|
||||
<h2 className={"mau"}>Host Game</h2>
|
||||
|
||||
@@ -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