Skip to content

Commit

Permalink
update: update api url
Browse files Browse the repository at this point in the history
  • Loading branch information
thepsalmist committed Oct 24, 2024
1 parent bc2564c commit 780f207
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,14 @@ const CITIES_LOCATION = {

const API = {
getAirData(city) {
return fetch(`https://api.sensors.africa/v2/data/air/?city=${city}`);
return fetch(`${API_BASE_URL}/data/air/?city=${city}`);
},
getWeeklyP2Data(city) {
const fromDate = new Date(Date.now() - 7 * 24 * 3600 * 1000)
.toISOString()
.substring(0, 10);
return fetch(
`https://api.sensors.africa/v2/data/air/?city=${city}&from=${fromDate}&interval=day&value_type=P2`,
`${API_BASE_URL}/data/air/?city=${city}&from=${fromDate}&interval=day&value_type=P2`,
);
},
};
Expand Down
22 changes: 11 additions & 11 deletions src/components/DataArchives/DataArchives.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ const countryCode = "{country name}";
const allCities = `${API_BASE_URL}/cities`;
const specificCities = `${API_BASE_URL}/data/air?city={slug}&`;
const nodes = `${API_BASE_URL}/nodes`;
const data5 = "http://api.sensors.africa/static/v2/data.json";
const data1 = "http://api.sensors.africa/static/v2/data.1h.json";
const data24 = "http://api.sensors.africa/static/v2/data.24h.json";
const dataDust = "http://api.sensors.africa/static/v2/data.dust.min.json";
const otherSensors = "http://api.sensors.africa/static/v2/data.temp.min.json";
const data5 = `${API_STATIC_URL}/data.json`;
const data1 = `${API_STATIC_URL}/data.1h.json`;
const data24 = `${API_STATIC_URL}/data.24h.json`;
const dataDust = `${API_STATIC_URL}/data.dust.min.json`;
const otherSensors = `${API_STATIC_URL}/data.temp.min.json`;

const toFrom = "{YYYY - mm - dd}";
const valueType = "{P1, P2, temperature, humidity}";
Expand Down Expand Up @@ -318,7 +318,7 @@ function DataArchives(props) {
<Grid item className={classes.dt}>
<a
className={classes.link}
href="https://api.sensors.africa/v2/data/air?city={slug}&"
href={specificCities}
target="_blank"
rel="noopener noreferrer"
>
Expand Down Expand Up @@ -370,7 +370,7 @@ function DataArchives(props) {
<Grid item className={classes.dt}>
<a
className={classes.link}
href="https://api.sensors.africa/static/v2/data.json"
href={data5}
target="_blank"
rel="noopener noreferrer"
>
Expand All @@ -396,7 +396,7 @@ function DataArchives(props) {
<Grid item className={classes.dt}>
<a
className={classes.link}
href="https://api.sensors.africa/static/v2/data.1h.json"
href={data1}
target="_blank"
rel="noopener noreferrer"
>
Expand All @@ -421,7 +421,7 @@ function DataArchives(props) {
<Grid item className={classes.dt}>
<a
className={classes.link}
href="https://api.sensors.africa/static/v2/data.24.json"
href={data24}
target="_blank"
rel="noopener noreferrer"
>
Expand All @@ -446,7 +446,7 @@ function DataArchives(props) {
<Grid item className={classes.dt}>
<a
className={classes.link}
href="https://api.sensors.africa/static/v2/data.dust.min.json"
href={dataDust}
target="_blank"
rel="noopener noreferrer"
>
Expand All @@ -472,7 +472,7 @@ function DataArchives(props) {
<Grid item className={classes.dt}>
<a
className={classes.link}
href="https://api.sensors.africa/static/v2/data.temp.min.json"
href={otherSensors}
target="_blank"
rel="noopener noreferrer"
>
Expand Down

0 comments on commit 780f207

Please sign in to comment.