this.setState(({ users }) => ({
users: this.addPermissionToEntity(users, login, permission),
+ loading: true,
}));
const request = isProjectCreator
permission,
});
- return request.then(this.props.refresh).catch(() => {
- this.setState(({ users }) => ({
- users: this.removePermissionFromEntity(users, login, permission),
- }));
- });
+ return request
+ .then(this.props.refresh)
+ .then(() => this.setState({ loading: false }))
+ .catch(() => {
+ this.setState(({ users }) => ({
+ users: this.removePermissionFromEntity(users, login, permission),
+ loading: false,
+ }));
+ });
};
revokePermissionFromUser = (login: string, permission: string) => {
this.setState(({ users }) => ({
users: this.removePermissionFromEntity(users, login, permission),
+ loading: true,
}));
const request = isProjectCreator
permission,
});
- return request.then(this.props.refresh).catch(() => {
- this.setState(({ users }) => ({
- users: this.addPermissionToEntity(users, login, permission),
- }));
- });
+ return request
+ .then(this.props.refresh)
+ .then(() => this.setState({ loading: false }))
+ .catch(() => {
+ this.setState(({ users }) => ({
+ users: this.addPermissionToEntity(users, login, permission),
+ loading: false,
+ }));
+ });
};
grantPermissionToGroup = (groupName: string, permission: string) => {
this.setState(({ groups }) => ({
groups: this.addPermissionToEntity(groups, groupName, permission),
+ loading: true,
}));
return api
permission,
})
.then(this.props.refresh)
+ .then(() => this.setState({ loading: false }))
.catch(() => {
this.setState(({ groups }) => ({
groups: this.removePermissionFromEntity(groups, groupName, permission),
+ loading: false,
}));
});
};
this.setState(({ groups }) => ({
groups: this.removePermissionFromEntity(groups, groupName, permission),
+ loading: true,
}));
return api
permission,
})
.then(this.props.refresh)
+ .then(() => this.setState({ loading: false }))
.catch(() => {
this.setState(({ groups }) => ({
groups: this.addPermissionToEntity(groups, groupName, permission),
+ loading: false,
}));
});
};