diff --git a/gatsby-node.js b/gatsby-node.js index 345d51f1..0b460e52 100755 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -202,9 +202,7 @@ const createTypeDocPage = async (createPage, name, downloadUrl) => { // https://github.com/swagger-api/swagger-js const fetchSwaggerSpec = async (component) => { try { - const client = await Swagger( - `https://${component}.mainnet.oceanprotocol.com/spec` - ) + const client = await Swagger(`http://localhost:5000/spec`) return client.spec // The resolved spec // client.originalSpec // In case you need it diff --git a/src/templates/Swagger/Paths.jsx b/src/templates/Swagger/Paths.jsx index f1675478..0f1d311e 100644 --- a/src/templates/Swagger/Paths.jsx +++ b/src/templates/Swagger/Paths.jsx @@ -4,8 +4,9 @@ import slugify from 'slugify' import { cleanPathKey } from './utils' import styles from './Paths.module.scss' import stylesDoc from '../Doc.module.scss' -import ReactJson from 'react-json-view' - +const ResponseExample = React.lazy(() => + import("./ResponseExample") +) const ParameterExample = ({ properties }) => ( // // HEADS UP! @@ -35,10 +36,10 @@ const ParameterExample = ({ properties }) => ( )} {(properties[key].type === 'integer' || properties[key].type === 'number') && ( - - {`${properties[key].example}`} - - )} + + {`${properties[key].example}`} + + )} {(properties[key].type === 'array' || properties[key].type === 'object') && JSON.stringify(properties[key].example, null, 2)} @@ -89,63 +90,31 @@ Parameters.propTypes = { parameters: PropTypes.array.isRequired } -const Responses = ({ responses }) => ( - <> +const Responses = ({ responses }) => { + const isSSR = typeof window === "undefined" + + return (<>
{key}
{responses[key].description}
- {typeof jsonExample === 'boolean' ? (
- {JSON.stringify(jsonExample)}
- ) : (
-
- )}
-
- {plainText}
-
+ {typeof jsonExample === 'boolean' ? (
+ {JSON.stringify(jsonExample)}
+ ) : (
+
+ )}
+
+ {plainText}
+