feat(swagger-ui-react): add support for persistAuthorization prop (#7842)
Closes #7389
This commit is contained in:
@@ -152,6 +152,12 @@ Configures the request snippet core plugin. See Swagger UI's [Display Configurat
|
||||
|
||||
⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change.
|
||||
|
||||
#### `persistAuthorization`: PropTypes.bool
|
||||
|
||||
If set, it persists authorization data and it would not be lost on browser close/refresh. The default is false.
|
||||
|
||||
⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change.
|
||||
|
||||
## Limitations
|
||||
|
||||
* Not all configuration bindings are available.
|
||||
|
||||
@@ -33,6 +33,7 @@ export default class SwaggerUI extends React.Component {
|
||||
deepLinking: typeof this.props.deepLinking === "boolean" ? this.props.deepLinking : false,
|
||||
showExtensions: this.props.showExtensions,
|
||||
filter: ["boolean", "string"].includes(typeof this.props.filter) ? this.props.filter : false,
|
||||
persistAuthorization: this.props.persistAuthorization,
|
||||
})
|
||||
|
||||
this.system = ui
|
||||
@@ -122,6 +123,7 @@ SwaggerUI.propTypes = {
|
||||
requestSnippets: PropTypes.object,
|
||||
tryItOutEnabled: PropTypes.bool,
|
||||
displayRequestDuration: PropTypes.bool,
|
||||
persistAuthorization: PropTypes.bool,
|
||||
}
|
||||
|
||||
SwaggerUI.defaultProps = {
|
||||
@@ -155,4 +157,5 @@ SwaggerUI.defaultProps = {
|
||||
defaultExpanded: true,
|
||||
languages: null, // e.g. only show curl bash = ["curl_bash"]
|
||||
},
|
||||
persistAuthorization: false,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user