Skip to content

Commit

Permalink
ui: update URL for fetching exchange rates
Browse files Browse the repository at this point in the history
  • Loading branch information
georgimld committed Jul 4, 2023
1 parent 96d396c commit f106fd8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
| REACT_APP_VERSION | - | Injected version via `$npm_package_version` in`.env` file to ensure the version is shown in the frontend |
| API_HOST | - | IP address of the api. This is only required if nginx proxy is used. <br>**Hint:** When deployed locally the host is set to localhost |
| API_PORT | 8080 | Port of the api. This is only required if nginx proxy is used |
| REACT_APP_EXCHANGE_RATE_URL | `https://data-api.ecb.europa.eu/service/data/EXR/D..EUR.SP00.A?lastNObservations=1` | The external URL where the exchange rates are fetched from |

### Email-Service

Expand Down
1 change: 1 addition & 0 deletions frontend/src/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const config = {
envMode: process.env.NODE_ENV || "development",
version: process.env.REACT_APP_VERSION || "",
exchangeRateUrl: process.env.REACT_APP_EXCHANGE_RATE_URL || "https://data-api.ecb.europa.eu/service/data/EXR/D..EUR.SP00.A?lastNObservations=1",
logging: {
isEnabled: process.env.REACT_APP_LOGGING === "true" ? true : false,
logLevel: process.env.REACT_APP_LOG_LEVEL || "trace",
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/getExchangeRates.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import axios from "axios";

import config from "./config";

const getRate = (series) => {
// catch non existing series
if (!series) return 0;
Expand All @@ -16,7 +18,7 @@ export async function getExchangeRates(baseCurrency = "EUR") {
const instance = axios.create();
delete instance.defaults.headers.common["Authorization"];
const response = await instance.get(
"https://data-api.ecb.europa.eu/service/data/EXR/D..EUR.SP00.A?lastNObservations=1",
config.exchangeRateUrl,
{ headers: {} }
);
const exchangeRates = {};
Expand Down

0 comments on commit f106fd8

Please sign in to comment.