Adds configurable hostname for multi environments
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
1ed47fb4fc
commit
b6be2a8ecb
1
.env.production
Normal file
1
.env.production
Normal file
@ -0,0 +1 @@
|
||||
VITE_API_URL=https://tmntapi.halfbinary.net
|
||||
@ -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<Movie[]>([])
|
||||
//const [selectedMovie, setSelectedMovie] = useState("")
|
||||
useEffect(() => {
|
||||
fetch('http://localhost:8080/movies')
|
||||
fetch(`${hostName}/movies`)
|
||||
.then((response => response.json()))
|
||||
.then((data) => {
|
||||
setMovies(data)
|
||||
|
||||
2
src/Config.ts
Normal file
2
src/Config.ts
Normal file
@ -0,0 +1,2 @@
|
||||
const hostName = import.meta.env.VITE_API_URL
|
||||
export default hostName
|
||||
Loading…
x
Reference in New Issue
Block a user