From 623f9033994f725fdd2746d89d4161a66e55dcee Mon Sep 17 00:00:00 2001 From: Fuly <37185496+FulytheFox@users.noreply.github.com> Date: Fri, 30 Apr 2021 13:35:29 +0200 Subject: [PATCH] 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 --- Ecosia/Ecosia.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ecosia/Ecosia.js b/Ecosia/Ecosia.js index 6baf6d2..2797884 100644 --- a/Ecosia/Ecosia.js +++ b/Ecosia/Ecosia.js @@ -34,10 +34,10 @@ if (Device.isUsingDarkAppearance()) { //////////////////////////////////////////////////////////////////////////////// async function getTreeCounter(token) { 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 res = await req.loadJSON() - return parseInt(res.counterValue) + return parseInt(res.personal_counter) } catch (error) { throw new Error('An error occurred when loading data from the Ecosia API. Please check the entered token.') }