From fe25d8c394ca27044173df3f35bda526f642823e Mon Sep 17 00:00:00 2001 From: Tereshchenko Aleksandr Date: Tue, 19 Mar 2024 13:10:40 +0200 Subject: [PATCH] Show person switcher also when isAdmin --- frontend/src/containers/User/index.js | 5 ++++- frontend/src/util/apiConnection.js | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/src/containers/User/index.js b/frontend/src/containers/User/index.js index e5ed2464..5059d3c3 100644 --- a/frontend/src/containers/User/index.js +++ b/frontend/src/containers/User/index.js @@ -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) || @@ -88,7 +91,7 @@ export class UserPage extends Component { )} - {process.env.NODE_ENV !== 'production' ? + {process.env.NODE_ENV !== 'production' || isAdmin ? { }) } -const isDevEnv = process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'staging' +const isDevEnv = process.env.NODE_ENV === 'development' const devDefaultOptions = { headers: {