Skip to content

Commit add4f6f

Browse files
updated user profile form
1 parent 272ac51 commit add4f6f

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

src/components/Users/form/UsersForm.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,18 @@ class UsersForm extends Component {
7070

7171
{ this.props.currentUser && this.props.currentUser.role === 'admin' && !this.props.isProfile &&
7272
<>
73-
<RadioFormItem
74-
name={'role'}
75-
schema={usersFields}
76-
/>
77-
78-
<SwitchFormItem
79-
name={'disabled'}
80-
schema={usersFields}
81-
/>
73+
{this.props.isProfile ? null : (
74+
<>
75+
<SwitchFormItem
76+
name={'disabled'}
77+
schema={usersFields}
78+
/>
79+
<RadioFormItem
80+
name={'role'}
81+
schema={usersFields}
82+
/>
83+
</>
84+
)}
8285
</>
8386
}
8487

src/components/Users/form/UsersFormPage.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ class UsersFormPage extends Component {
4343

4444
isProfile = () => {
4545
const { match } = this.props;
46+
const currentUser = JSON.parse(localStorage.getItem('user'));
47+
const currentUserId = currentUser.user.id;
48+
if (match.params.id === currentUserId) {
49+
return true
50+
}
4651
return match.url === '/app/profile';
4752
};
4853

0 commit comments

Comments
 (0)