diff --git a/.env b/.env new file mode 100644 index 0000000..ca9963a --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VITE_API_URL=http://localhost:8080 \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..30b107c --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +VITE_API_URL=https://tmntapi.halfbinary.net \ No newline at end of file diff --git a/src/App.tsx b/src/App.tsx index fcb3d31..cbf096e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,12 +1,13 @@ import {useEffect, useState} from 'react' import './App.css' import {Movie} from "./Models.ts"; +import hostName from "./Config.ts"; function App() { const [movies, setMovies] = useState([]) //const [selectedMovie, setSelectedMovie] = useState("") useEffect(() => { - fetch('http://localhost:8080/movies') + fetch(`${hostName}/movies`) .then((response => response.json())) .then((data) => { setMovies(data) diff --git a/src/Config.ts b/src/Config.ts new file mode 100644 index 0000000..557812a --- /dev/null +++ b/src/Config.ts @@ -0,0 +1,2 @@ +const hostName = import.meta.env.VITE_API_URL +export default hostName