Skip to content

Commit

Permalink
Url (#6)
Browse files Browse the repository at this point in the history
* deploy frontend

* Add requirements.txt for fast api

* fix env var

* f

* http -> https conditionally

* fix
  • Loading branch information
phyeony authored Dec 8, 2022
1 parent ae60034 commit 8ee4592
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ function App() {
const PUBLIC_TRANSPORTATION = "Public Transportation"
const TOURISM_CULTURE = "Tourism & Culture"
const MAX_NUM = 13025
const BACKEND_DOMAIN = process.env.REACT_APP_BACKEND_DOMAIN ?? "localhost"
const BACKEND_PORT = process.env.REACT_APP_BACKEND_PORT ?? "8000"
const HTTPS = process.env.REACT_APP_HTTPS ?? "http"
const URL = process.env.REACT_APP_ENV === "railway" ? `https://${process.env.REACT_APP_BACKEND_DOMAIN}` : 'http://localhost:8000'

const [airbnbList, setAirbnbList] = useState([])
const [state, setState] = useState({
Expand Down Expand Up @@ -87,7 +85,7 @@ function App() {
}
}
try {
const res = await fetch(`${HTTPS}://${BACKEND_DOMAIN}:${BACKEND_PORT}/api/airbnb_list`, {
const res = await fetch(`${URL}/api/airbnb_list`, {
method: 'POST',
headers: {
'Accept': 'application/json',
Expand Down

0 comments on commit 8ee4592

Please sign in to comment.