From ec5be08454d65d153d5227e20fe2963413afd309 Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Sun, 20 Sep 2020 14:37:46 +0100 Subject: [PATCH 1/2] Fix #17 by checking if there's more than one member type and returning the correct data --- commands/verify.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/commands/verify.js b/commands/verify.js index 1d4ba00..3be90de 100644 --- a/commands/verify.js +++ b/commands/verify.js @@ -58,7 +58,13 @@ module.exports = { const apiResponse = await getContent(apiurl); - return JSON.parse(apiResponse).table1.table1_Product_Collection.table1_Product[0].Detail_Collection.Detail; + // Check to see if we only get one type of member + if (apiResponse.table1.table1_Product_Collection.table1_Product[0] === undefined) { + return JSON.parse(apiResponse).table1.table1_Product_Collection.table1_Product.Detail_Collection.Detail; + } else { + return JSON.parse(apiResponse).table1.table1_Product_Collection.table1_Product[0].Detail_Collection.Detail; + } + } /** -- GitLab From 736da31c49565234fbd1a20e5c76edd2870d3238 Mon Sep 17 00:00:00 2001 From: Imran Hussain Date: Sun, 20 Sep 2020 14:45:49 +0100 Subject: [PATCH 2/2] Fix linting error --- commands/verify.js | 1 - 1 file changed, 1 deletion(-) diff --git a/commands/verify.js b/commands/verify.js index 3be90de..55514c4 100644 --- a/commands/verify.js +++ b/commands/verify.js @@ -64,7 +64,6 @@ module.exports = { } else { return JSON.parse(apiResponse).table1.table1_Product_Collection.table1_Product[0].Detail_Collection.Detail; } - } /** -- GitLab