From 4bab76dcd5509cdccdc49a69394ce31b4799c9a3 Mon Sep 17 00:00:00 2001 From: George J Padayatti Date: Tue, 2 Apr 2024 17:16:08 +0530 Subject: [PATCH] Fix: Loading Swagger UI JS script Signed-off-by: George J Padayatti --- src/pages/datamarketplace.js | 12 +++++++++--- src/pages/domain.js | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/pages/datamarketplace.js b/src/pages/datamarketplace.js index 905d753..d45e0b6 100644 --- a/src/pages/datamarketplace.js +++ b/src/pages/datamarketplace.js @@ -14,17 +14,23 @@ export default function DataMarketplace() { NordXDataspace (NXD) -
{() => { - window.onload = () => { + + const script = document.createElement("script"); + script.src = 'https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui-bundle.js'; // whatever url you want here + script.charset = "utf-8"; + script.crossOrigin = true; + script.async = false; + script.onload = function () { window.ui = SwaggerUIBundle({ url: '/openapi/datamarketplace.yaml', dom_id: '#swagger-ui', }); - } + }; + document.head.appendChild(script); }}