diff --git a/frontend/src/app/components/api-docs/api-docs.component.ts b/frontend/src/app/components/api-docs/api-docs.component.ts index 16cbac397..285efa18a 100644 --- a/frontend/src/app/components/api-docs/api-docs.component.ts +++ b/frontend/src/app/components/api-docs/api-docs.component.ts @@ -3429,16 +3429,16 @@ export class ApiDocsComponent implements OnInit { ws.addEventListener('message', function incoming({data}) { const res = JSON.parse(data.toString()); if (res.blocks) { - document.getElementById("result").textContent = JSON.stringify(res.blocks, undefined, 2); + document.getElementById("result-blocks").textContent = JSON.stringify(res.blocks, undefined, 2); } if (res.mempoolInfo) { - document.getElementById("result").textContent = JSON.stringify(res.mempoolInfo, undefined, 2); + document.getElementById("result-mempool-info").textContent = JSON.stringify(res.mempoolInfo, undefined, 2); } if (res.transactions) { - document.getElementById("result").textContent = JSON.stringify(res.transactions, undefined, 2); + document.getElementById("result-transactions").textContent = JSON.stringify(res.transactions, undefined, 2); } if (res.mempoolBlocks) { - document.getElementById("result").textContent = JSON.stringify(res.mempoolBlocks, undefined, 2); + document.getElementById("result-mempool-blocks").textContent = JSON.stringify(res.mempoolBlocks, undefined, 2); } }); `, diff --git a/frontend/src/app/components/api-docs/code-template.component.ts b/frontend/src/app/components/api-docs/code-template.component.ts index 396a22b77..417653b01 100644 --- a/frontend/src/app/components/api-docs/code-template.component.ts +++ b/frontend/src/app/components/api-docs/code-template.component.ts @@ -172,6 +172,14 @@ init();`; importText = ``; } + let resultHtml = '
';
+      if (this.method === 'websocket') {
+        resultHtml = `

+    

+    

+    
`;
+      }
+
       return `
 
   
@@ -184,7 +192,7 @@ init();`;
     
   
   
-    

+    ${resultHtml}
   
 `;
     }