mirror of
https://github.com/ThisIsBenny/iOS-Widgets.git
synced 2025-04-19 15:27:40 +00:00
Fixed small changes in the Ecosia API
- URL of Ecosia adapted due to changes in the API - Changed key from JSON map due to changes in the API
This commit is contained in:
parent
4a40b1895f
commit
623f903399
1 changed files with 2 additions and 2 deletions
|
@ -34,10 +34,10 @@ if (Device.isUsingDarkAppearance()) {
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
async function getTreeCounter(token) {
|
async function getTreeCounter(token) {
|
||||||
try {
|
try {
|
||||||
const url = "https://api.ecosia.org/v1/accounts/personalcounter?token=" + token
|
const url = "https://api.ecosia.org/v1/accounts/v2/personal_counter?token=" + token
|
||||||
let req = new Request(url)
|
let req = new Request(url)
|
||||||
let res = await req.loadJSON()
|
let res = await req.loadJSON()
|
||||||
return parseInt(res.counterValue)
|
return parseInt(res.personal_counter)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error('An error occurred when loading data from the Ecosia API. Please check the entered token.')
|
throw new Error('An error occurred when loading data from the Ecosia API. Please check the entered token.')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue