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
|
#### `onComplete`: PropTypes.func
|
||||||
|
|
||||||
|
> `(system) => void`
|
||||||
|
|
||||||
A callback function that is triggered when Swagger-UI finishes rendering an OpenAPI document.
|
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
|
#### `requestInterceptor`: PropTypes.func
|
||||||
|
|
||||||
> `req => req` or `req => Promise<req>`.
|
> `req => req` or `req => Promise<req>`.
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export default class SwaggerUI extends React.Component {
|
|||||||
|
|
||||||
onComplete = () => {
|
onComplete = () => {
|
||||||
if (typeof this.props.onComplete === "function") {
|
if (typeof this.props.onComplete === "function") {
|
||||||
return this.props.onComplete()
|
return this.props.onComplete(this.system)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,4 +80,4 @@ SwaggerUI.propTypes = {
|
|||||||
requestInterceptor: PropTypes.func,
|
requestInterceptor: PropTypes.func,
|
||||||
responseInterceptor: PropTypes.func,
|
responseInterceptor: PropTypes.func,
|
||||||
onComplete: PropTypes.func,
|
onComplete: PropTypes.func,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user