-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Loading swagger UI by using javascript script loading
Signed-off-by: George J Padayatti <[email protected]>
- Loading branch information
1 parent
8fdc0b9
commit 165c9be
Showing
8 changed files
with
93 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import React from 'react'; | ||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; | ||
import Layout from '@theme/Layout'; | ||
import Footer from '@site/src/components/Footer'; | ||
import Helmet from "react-helmet"; | ||
import BrowserOnly from '@docusaurus/BrowserOnly'; | ||
|
||
export default function DataIntermediation() { | ||
const { siteConfig } = useDocusaurusContext(); | ||
return ( | ||
<Layout | ||
title={`${siteConfig.title}`} | ||
description="Enabling trust in the data ecosystem for next-generation data sharing. "> | ||
<Helmet> | ||
<title>NordXDataspace (NXD)</title> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/swagger-ui.css" /> | ||
</Helmet> | ||
<div id="swagger-ui"></div> | ||
<BrowserOnly> | ||
{() => { | ||
|
||
const script = document.createElement("script"); | ||
script.src = 'https://unpkg.com/[email protected]/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); | ||
}} | ||
</BrowserOnly> | ||
<Footer /> | ||
</Layout> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; | ||
import Layout from '@theme/Layout'; | ||
import Footer from '@site/src/components/Footer'; | ||
import Helmet from "react-helmet"; | ||
import BrowserOnly from '@docusaurus/BrowserOnly'; | ||
|
||
export default function DataMarketplace() { | ||
const { siteConfig } = useDocusaurusContext(); | ||
return ( | ||
<Layout | ||
title={`${siteConfig.title}`} | ||
description="Enabling trust in the data ecosystem for next-generation data sharing. "> | ||
<Helmet> | ||
<title>NordXDataspace (NXD)</title> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/swagger-ui.css" /> | ||
<script src="https://unpkg.com/[email protected]/swagger-ui-bundle.js" crossorigin></script> | ||
</Helmet> | ||
<div id="swagger-ui"></div> | ||
<BrowserOnly> | ||
{() => { | ||
window.onload = () => { | ||
window.ui = SwaggerUIBundle({ | ||
url: '/openapi/datamarketplace.yaml', | ||
dom_id: '#swagger-ui', | ||
}); | ||
} | ||
}} | ||
</BrowserOnly> | ||
<Footer /> | ||
</Layout> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import React from 'react'; | ||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; | ||
import Layout from '@theme/Layout'; | ||
import Footer from '../components/Footer'; | ||
import Footer from '@site/src/components/Footer'; | ||
import Helmet from "react-helmet"; | ||
import SwaggerUI from "swagger-ui-react" | ||
import "swagger-ui-react/swagger-ui.css" | ||
import BrowserOnly from '@docusaurus/BrowserOnly'; | ||
|
||
export default function Domain() { | ||
const { siteConfig } = useDocusaurusContext(); | ||
|
@@ -14,9 +13,21 @@ export default function Domain() { | |
description="Enabling trust in the data ecosystem for next-generation data sharing. "> | ||
<Helmet> | ||
<title>NordXDataspace (NXD)</title> | ||
<link rel="stylesheet" href="https://unpkg.com/[email protected]/swagger-ui.css" /> | ||
<script src="https://unpkg.com/[email protected]/swagger-ui-bundle.js" crossorigin></script> | ||
</Helmet> | ||
<SwaggerUI url="openapi/data-marketplace.yaml" /> | ||
<div id="swagger-ui"></div> | ||
<BrowserOnly> | ||
{() => { | ||
window.onload = () => { | ||
window.ui = SwaggerUIBundle({ | ||
url: '/openapi/datamarketplace.yaml', | ||
dom_id: '#swagger-ui', | ||
}); | ||
} | ||
}} | ||
</BrowserOnly> | ||
<Footer /> | ||
</Layout> | ||
); | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.