Skip to content

Commit fc8b350

Browse files
authored
Merge pull request #39 from oslabs-beta/fixSingleResponse
Fix single response
2 parents a4538f4 + 079d172 commit fc8b350

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/client/components/display/ResponseEventsDisplay.jsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,29 @@ const ResponseEventsDisplay = ({ response }) => {
1919
<div className="okay" dangerouslySetInnerHTML={{__html: createDOMPurify.sanitize(events[0])}} />
2020
)
2121
}
22+
else if (events.length > 1) {
23+
if (events) {
24+
displayContents.push(
25+
<div className="json-response" key="jsonresponsediv">
26+
<JSONPretty data={events} space="4" theme={{
27+
main: 'line-height:1.3; color: midnightblue; background:#RRGGBB; overflow:auto;',
28+
key: 'color:#0089D0;', // bluetwo
29+
string: 'color:#15B78F;',// greenone
30+
value: 'color:#fd971f;', // a nice orange
31+
boolean: 'color:#E00198;', // gqlpink
32+
}}
33+
/>
34+
</div>
35+
);
36+
}
37+
38+
}
2239
// Otherwise, render a single display
2340
else {
2441
if (events) {
2542
displayContents.push(
2643
<div className="json-response" key="jsonresponsediv">
27-
<JSONPretty data={events} space="4" theme={{
44+
<JSONPretty data={events[0]} space="4" theme={{
2845
main: 'line-height:1.3; color: midnightblue; background:#RRGGBB; overflow:auto;',
2946
key: 'color:#0089D0;', // bluetwo
3047
string: 'color:#15B78F;',// greenone

0 commit comments

Comments
 (0)