Commit 6f0d6cca authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fix missing re authorization on updated views.

parent b71f81d5
......@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import { withStyles } from '@material-ui/core/styles'
import { compose } from 'recompose'
import { withErrors } from './errors'
import { withApi, DoesNotExist } from './api'
import { withApi } from './api'
import Search from './search/Search'
import SearchContext from './search/SearchContext'
import { Typography } from '@material-ui/core'
......
......@@ -698,6 +698,8 @@ export const ApiProvider = compose(withKeycloak, withErrors)(ApiProviderComponen
const LoginRequired = withStyles(LoginRequiredUnstyled.styles)(LoginRequiredUnstyled)
const __reauthorize_trigger_changes = ['api', 'calcId', 'uploadId', 'calc_id', 'upload_id']
class WithApiComponent extends React.Component {
static propTypes = {
raiseError: PropTypes.func.isRequired,
......@@ -719,7 +721,7 @@ class WithApiComponent extends React.Component {
}
componentDidUpdate(prevProps) {
if (prevProps.api !== this.props.api) {
if (__reauthorize_trigger_changes.find(key => this.props[key] !== prevProps[key])) {
this.setState({notAuthorized: false})
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment