From 4c8ae2c84c02c811dc3107885a1b2316d724aaa9 Mon Sep 17 00:00:00 2001 From: hnouts <hnouts@grandlyon.com> Date: Wed, 22 Mar 2023 10:23:56 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B5=20threads?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/onDeleteAccount.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/onDeleteAccount.js b/src/onDeleteAccount.js index aba5bbc..015bb91 100644 --- a/src/onDeleteAccount.js +++ b/src/onDeleteAccount.js @@ -55,10 +55,10 @@ async function fetchNewAccessToken(accountSecret) { // split the result into an array of strings containing a single json object // then check if the resulting json has an access_token field // return it if it does or return undefined - return result.match(/.+/g).map(s => { - result = JSON.parse(s) - if (result.access_token) { - return result.access_token + return result.match(/.+/g).map(jsonString => { + const jsonObject = JSON.parse(jsonString) + if (jsonObject.access_token) { + return jsonObject.access_token } }) }) -- GitLab