improvement: expose system object in swagger-ui-react's onComplete callback (via #5221)

* expose swagger object so it can be controlled in the onComplete function

* docs: swagger-ui-react onComplete system argument
This commit is contained in:
Glen Schrader
2019-03-14 20:29:40 -06:00
committed by kyle
parent 65e8abde55
commit ccf17e90e2
2 changed files with 6 additions and 2 deletions

View File

@@ -45,8 +45,12 @@ Remote URL to an OpenAPI document that Swagger UI will fetch, parse, and display
#### `onComplete`: PropTypes.func
> `(system) => void`
A callback function that is triggered when Swagger-UI finishes rendering an OpenAPI document.
Swagger UI's `system` object is passed as an argument.
#### `requestInterceptor`: PropTypes.func
> `req => req` or `req => Promise<req>`.

View File

@@ -66,7 +66,7 @@ export default class SwaggerUI extends React.Component {
onComplete = () => {
if (typeof this.props.onComplete === "function") {
return this.props.onComplete()
return this.props.onComplete(this.system)
}
}
}