added env file for api url

This commit is contained in:
2023-03-15 18:37:32 +01:00
parent fd8e2a7c8d
commit 2a39573f88
3 changed files with 3 additions and 2 deletions

1
.env.example Normal file
View File

@@ -0,0 +1 @@
REACT_APP_API_URL="localhost:5000"

View File

@@ -3,7 +3,7 @@ import {GHButton} from "../components/Button";
import {Link} from "react-router-dom";
import useTitle from "../../utils/TitleHook";
const ROOM_URL = 'http://localhost:5062/room';
const ROOM_URL = `http://${process.env.REACT_APP_API_URL}/room`;
const Home = () => {

View File

@@ -10,7 +10,7 @@ const Room = () => {
const {roomId} = useParams();
const WS_URL = `ws://localhost:5062/room/${roomId}`;
const WS_URL = `ws://${process.env.REACT_APP_API_URL}/room/${roomId}`;
const [message, setMessage] = React.useState<string>('');
const [messages, setMessages] = React.useState<string[]>([]);