Spaces:
Running
Running
Update script.js
Browse files
script.js
CHANGED
@@ -7,7 +7,7 @@ async function convertCurrency() {
|
|
7 |
|
8 |
if (amount && fromCurrency && toCurrency) {
|
9 |
try {
|
10 |
-
const response = await fetch(`https://
|
11 |
const data = await response.json();
|
12 |
const rate = data.rates[toCurrency];
|
13 |
const convertedAmount = (amount * rate).toFixed(2);
|
|
|
7 |
|
8 |
if (amount && fromCurrency && toCurrency) {
|
9 |
try {
|
10 |
+
const response = await fetch(`https://api.exchangerate-api.com/v4/latest/${fromCurrency}`);
|
11 |
const data = await response.json();
|
12 |
const rate = data.rates[toCurrency];
|
13 |
const convertedAmount = (amount * rate).toFixed(2);
|