Skip to content

Commit

Permalink
Show person switcher also when isAdmin
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksTeresh committed Mar 19, 2024
1 parent a6f3316 commit fe25d8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion frontend/src/containers/User/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ export class UserPage extends Component {

render() {
const { user } = this.props
const isAdmin = Boolean(
((user || {}).roles || [])
.find(role => role.role === 'admin'))
const unitManagers = this.props.managers.filter(manager =>
manager.programmeId === parseInt(this.state.programmeId, 10))
const isStaff = user && ((user.roles && user.roles.length > 0) ||
Expand All @@ -88,7 +91,7 @@ export class UserPage extends Component {
)}
</div>
</div>
{process.env.NODE_ENV !== 'production' ?
{process.env.NODE_ENV !== 'production' || isAdmin ?
<PersonSwitcher
persons={this.props.persons}
managers={this.props.managers}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/util/apiConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const getAxios = () => {
})
}

const isDevEnv = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'staging'
const isDevEnv = process.env.NODE_ENV === 'development'

const devDefaultOptions = {
headers: {
Expand Down

0 comments on commit fe25d8c

Please sign in to comment.