Commit ef2530b8 authored by Imran Hussain's avatar Imran Hussain
Browse files

Fix #17 by checking if there's more than one member type and returning the correct data

parent 0b33ef7b
......@@ -58,7 +58,12 @@ 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;
}
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment