From ada2aa4ce8fcaa67859cd8e41f963500f2c8690c Mon Sep 17 00:00:00 2001 From: Joel Torstensson Date: Thu, 27 Dec 2018 11:06:02 +0100 Subject: [PATCH] feat: example can handle multiple profile graphql queries --- example/index.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/example/index.js b/example/index.js index 4a581c52..c13ebb23 100644 --- a/example/index.js +++ b/example/index.js @@ -67,9 +67,18 @@ profileGraphQL.addEventListener('click', () => { Box.profileGraphQL(query).then(res => { console.log(res) profileGraphQLData.innerHTML = '' - Object.entries(res.profile).map(kv => { - profileGraphQLData.innerHTML +=kv[0] + ': ' + kv[1] + '
' - }) + if (res.profile) { + Object.entries(res.profile).map(kv => { + profileGraphQLData.innerHTML +=kv[0] + ': ' + kv[1] + '
' + }) + } else if (res.profiles) { + res.profiles.map(profile => { + Object.entries(profile).map(kv => { + profileGraphQLData.innerHTML +=kv[0] + ': ' + kv[1] + '
' + }) + profileGraphQLData.innerHTML += '
' + }) + } }) })