From 15750ad3fbf2d4b0383fddd6f53046d3c2c510c7 Mon Sep 17 00:00:00 2001 From: MShultz Date: Tue, 11 Aug 2020 00:06:25 -0600 Subject: [PATCH] Adds fix for empty last edited date. --- index.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index a14d018..cd6c533 100644 --- a/index.js +++ b/index.js @@ -69,16 +69,22 @@ let pads = { data.results.push(entrySet); }); + let getEdited = []; if (data.results.length > 0) { data.results.forEach(function (value) { - let resultObject = api.getLastEdited(value.padName); - value.lastEdited = resultObject.lastEdited; - resultObject = api.padUsersCount(value.padName); - value.userCount = resultObject.padUsersCount; + getEdited.push( + api.getLastEdited(value.padName) + .then((resultObject) => { + value.lastEdited = resultObject.lastEdited; + resultObject = api.padUsersCount(value.padName); + value.userCount = resultObject.padUsersCount; + })); }); } else { data.message = 'No results'; } + + await Promise.all(getEdited); return data; }, };