feat: add apilayer as provider for fixer api (#127)
feat: add apilayer as provider for fixer api feat: update exchange rate when saving api key
This commit is contained in:
+4
-1
@@ -477,18 +477,21 @@ function addFixerKeyButton() {
|
||||
document.getElementById("addFixerKey").disabled = true;
|
||||
const apiKeyInput = document.querySelector("#fixerKey");
|
||||
apiKey = apiKeyInput.value.trim();
|
||||
const provider = document.querySelector("#fixerProvider").value;
|
||||
fetch("endpoints/currency/fixer_api_key.php", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
body: `api_key=${encodeURIComponent(apiKey)}`,
|
||||
body: `api_key=${encodeURIComponent(apiKey)} & provider=${encodeURIComponent(provider)}`,
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
showSuccessMessage(data.message);
|
||||
document.getElementById("addFixerKey").disabled = false;
|
||||
// update currency exchange rates
|
||||
fetch("endpoints/currency/update_exchange.php?force=true");
|
||||
} else {
|
||||
showErrorMessage(data.message);
|
||||
document.getElementById("addFixerKey").disabled = false;
|
||||
|
||||
Reference in New Issue
Block a user