Skip to content

Commit

Permalink
fix(auth): url change should flush auth (#7046)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathis-m committed Mar 10, 2021
1 parent f9e54a2 commit 219d886
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/plugins/topbar/topbar.jsx
Expand Up @@ -8,7 +8,8 @@ import {parseSearch, serializeSearch} from "../../core/utils"
export default class Topbar extends React.Component {

static propTypes = {
layoutActions: PropTypes.object.isRequired
layoutActions: PropTypes.object.isRequired,
authActions: PropTypes.object.isRequired
}

constructor(props, context) {
Expand All @@ -25,7 +26,19 @@ export default class Topbar extends React.Component {
this.setState({url: value})
}

flushAuthData() {
const { persistAuthorization } = this.props.getConfigs()
if (persistAuthorization)
{
return
}
this.props.authActions.restoreAuthorization({
authorized: {}
})
}

loadSpec = (url) => {
this.flushAuthData()
this.props.specActions.updateUrl(url)
this.props.specActions.download(url)
}
Expand Down Expand Up @@ -107,7 +120,7 @@ export default class Topbar extends React.Component {
const classNames = ["download-url-input"]
if (isFailed) classNames.push("failed")
if (isLoading) classNames.push("loading")

const { urls } = getConfigs()
let control = []
let formOnSubmit = null
Expand Down

0 comments on commit 219d886

Please sign in to comment.