Skip to content

Commit

Permalink
fix(swagger-ui-react): re-enable SSR support (#9035)
Browse files Browse the repository at this point in the history
SSR support was re-enabled by passing the oauth2RedirectUrl
prop only when defined.

Refs #8976
  • Loading branch information
char0n committed Jul 18, 2023
1 parent 58f83b6 commit 21a2ef5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flavors/swagger-ui-react/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class SwaggerUI extends React.Component {
filter: this.props.filter,
persistAuthorization: this.props.persistAuthorization,
withCredentials: this.props.withCredentials,
oauth2RedirectUrl: this.props.oauth2RedirectUrl
...(typeof this.props.oauth2RedirectUrl === "string" ? { oauth2RedirectUrl: this.props.oauth2RedirectUrl} : {})
})

this.system = ui
Expand Down Expand Up @@ -166,7 +166,7 @@ SwaggerUI.defaultProps = {
displayRequestDuration: false,
withCredentials: undefined,
persistAuthorization: false,
oauth2RedirectUrl: `${window.location.protocol}//${window.location.host}${window.location.pathname.substring(0, window.location.pathname.lastIndexOf("/"))}/oauth2-redirect.html`,
oauth2RedirectUrl: undefined,
}

SwaggerUI.presets = swaggerUIConstructor.presets
Expand Down

0 comments on commit 21a2ef5

Please sign in to comment.