Browse Source

update alamat api

master
Wanda Gusdya 3 years ago
parent
commit
f42a3724fe
  1. 2
      src/components/DetailModal.js
  2. 2
      src/components/ForecastContent.js
  3. 4
      src/components/WeatherCard.js
  4. 2
      src/components/WeatherCardContent.js

2
src/components/DetailModal.js

@ -4,7 +4,7 @@ import moment from "moment";
function DetailModal(props) {
const weather = props.weather
let url = `http://localhost:3001/images/${weather.summary.replaceAll(' ', '_')}.png`
let url = `http://157.245.192.125:3001/images/${weather.summary.replaceAll(' ', '_')}.png`
let formattedDate = moment(weather.date).format("DD/MM/YYYY HH:mm:ss")
let temperature = Math.round((weather.temperature + Number.EPSILON) * 100) / 100
let apparentTemperature = Math.round((weather.apparentTemperature + Number.EPSILON) * 100) / 100

2
src/components/ForecastContent.js

@ -11,7 +11,7 @@ function ForecastContent(props) {
if (props.forecast != null) {
const forecast = props.forecast
let url = `http://localhost:3001/images/${forecast.summary.replaceAll(' ', '_')}.png`
let url = `http://157.245.192.125:3001/images/${forecast.summary.replaceAll(' ', '_')}.png`
image = <img src={url} alt={forecast.summary} className="forecast-image"/>
let temperature = Math.round((forecast.temperature + Number.EPSILON) * 100) / 100
header = <p className="forecast-text">{temperature}&#8451;</p>

4
src/components/WeatherCard.js

@ -15,7 +15,7 @@ class WeatherCard extends React.Component {
};
}
componentDidMount() {
fetch(`http://localhost:3001/api/v1/weather/latest/${this.state.device}`)
fetch(`http://157.245.192.125:3001/api/v1/weather/latest/${this.state.device}`)
.then(res => res.json())
.then(
(result) => {
@ -35,7 +35,7 @@ class WeatherCard extends React.Component {
}
)
fetch(`http://localhost:3001/api/v1/weather/forecast/${this.state.device}`)
fetch(`http://157.245.192.125:3001/api/v1/weather/forecast/${this.state.device}`)
.then(res => res.json())
.then(
(result) => {

2
src/components/WeatherCardContent.js

@ -18,7 +18,7 @@ function WeatherCardContent(props) {
if (props.weather != null) {
const weather = props.weather
device = <h3>Device {weather.deviceId}</h3>
let url = `http://localhost:3001/images/${weather.summary.replaceAll(' ', '_')}.png`
let url = `http://157.245.192.125:3001/images/${weather.summary.replaceAll(' ', '_')}.png`
image = <img onClick={handleClick} src={url} alt={weather.summary} className="weather-image"/>
let temperature = Math.round((weather.temperature + Number.EPSILON) * 100) / 100
header = <h4>{temperature}&#8451;</h4>

Loading…
Cancel
Save