Skip to content

Commit

Permalink
Merge pull request #131 from GetDKAN/no-param-api-cleanup
Browse files Browse the repository at this point in the history
Add qs.stringfy to clean up api doc url
  • Loading branch information
brdunfield authored Aug 2, 2023
2 parents 778d555 + 3415372 commit 0ead67a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/templates/APIPage/APIPage.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import React from 'react';
import qs from 'qs';
import SwaggerUI from 'swagger-ui-react';
import 'swagger-ui-react/swagger-ui.css';

const APIPage = ({ hideAuth, additionalParams, rootUrl }) => (
<section className="ds-l-container">
const APIPage = ({ hideAuth, additionalParams, rootUrl }) => {
const hasACA = additionalParams && additionalParams.ACA ? true : false;
let params = {
authentication: hideAuth ? false : undefined,
ACA: hasACA ? additionalParams.ACA : undefined,
redirect: hasACA ? false : undefined,
};
return (
<section className="ds-l-container">
<SwaggerUI
url={`${rootUrl}?${hideAuth ? 'authentication=false&' : ''}${
additionalParams && additionalParams.ACA
? 'ACA=' + additionalParams.ACA + '&redirect=false'
: ''
}`}
url={`${rootUrl}${qs.stringify(params, { addQueryPrefix: true })}`}
docExpansion={'list'}
defaultModelsExpandDepth={-1}
/>
</section>
);
)
};

APIPage.defaultProps = {
hideAuth: true,
Expand Down

0 comments on commit 0ead67a

Please sign in to comment.