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:
@@ -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>`.
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user