You've already forked tf2wikipricing
refactor: less noise in queryExchangeRates
This commit is contained in:
@@ -3,13 +3,8 @@ chrome.runtime.onMessage.addListener(
|
|||||||
if (request.contentScriptQuery == "queryExchangeRates") {
|
if (request.contentScriptQuery == "queryExchangeRates") {
|
||||||
const url = "https://open.er-api.com/v6/latest/USD";
|
const url = "https://open.er-api.com/v6/latest/USD";
|
||||||
fetch(url)
|
fetch(url)
|
||||||
.then(response => {
|
.then(response => response.json())
|
||||||
console.log(response)
|
.then(json => sendResponse(json))
|
||||||
return response.json()
|
|
||||||
})
|
|
||||||
.then(json => {
|
|
||||||
sendResponse(json)
|
|
||||||
})
|
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error("Failed to get exchange rates", error);
|
console.error("Failed to get exchange rates", error);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user