fix(auth): url change should flush auth (#7046)
This commit is contained in:
@@ -8,7 +8,8 @@ import {parseSearch, serializeSearch} from "../../core/utils"
|
|||||||
export default class Topbar extends React.Component {
|
export default class Topbar extends React.Component {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
layoutActions: PropTypes.object.isRequired
|
layoutActions: PropTypes.object.isRequired,
|
||||||
|
authActions: PropTypes.object.isRequired
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props, context) {
|
constructor(props, context) {
|
||||||
@@ -25,7 +26,19 @@ export default class Topbar extends React.Component {
|
|||||||
this.setState({url: value})
|
this.setState({url: value})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flushAuthData() {
|
||||||
|
const { persistAuthorization } = this.props.getConfigs()
|
||||||
|
if (persistAuthorization)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.props.authActions.restoreAuthorization({
|
||||||
|
authorized: {}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
loadSpec = (url) => {
|
loadSpec = (url) => {
|
||||||
|
this.flushAuthData()
|
||||||
this.props.specActions.updateUrl(url)
|
this.props.specActions.updateUrl(url)
|
||||||
this.props.specActions.download(url)
|
this.props.specActions.download(url)
|
||||||
}
|
}
|
||||||
@@ -107,7 +120,7 @@ export default class Topbar extends React.Component {
|
|||||||
const classNames = ["download-url-input"]
|
const classNames = ["download-url-input"]
|
||||||
if (isFailed) classNames.push("failed")
|
if (isFailed) classNames.push("failed")
|
||||||
if (isLoading) classNames.push("loading")
|
if (isLoading) classNames.push("loading")
|
||||||
|
|
||||||
const { urls } = getConfigs()
|
const { urls } = getConfigs()
|
||||||
let control = []
|
let control = []
|
||||||
let formOnSubmit = null
|
let formOnSubmit = null
|
||||||
|
|||||||
Reference in New Issue
Block a user