diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..0673b01 --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +REACT_APP_API_URL="localhost:5000" \ No newline at end of file diff --git a/src/layout/pages/Home.tsx b/src/layout/pages/Home.tsx index 4ceeec9..8e84117 100644 --- a/src/layout/pages/Home.tsx +++ b/src/layout/pages/Home.tsx @@ -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 = () => { diff --git a/src/layout/pages/Room.tsx b/src/layout/pages/Room.tsx index ff83fbd..d3ae0e3 100644 --- a/src/layout/pages/Room.tsx +++ b/src/layout/pages/Room.tsx @@ -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(''); const [messages, setMessages] = React.useState([]);