provided changeType method in peopleStore with a prop that prevents fetching users on call

This commit is contained in:
mushka 2022-10-06 15:57:12 +03:00
parent 328b1270c2
commit 1b80b97547

View File

@ -103,7 +103,13 @@ class PeopleStore {
this.changeType(action, getUsersToMakeEmployeesIds, t);
};
changeType = (type, users, t, needClearSelection = true) => {
changeType = (
type,
users,
t,
needClearSelection = true,
needFetchUsers = true
) => {
const { changeAdmins } = this.setupStore;
const { getUsersList } = this.usersStore;
const { filter } = this.filterStore;
@ -115,7 +121,7 @@ class PeopleStore {
if (type === "admin") {
changeAdmins(userIDs, fullAccessId, true).then((res) => {
getUsersList(filter);
needFetchUsers && getUsersList(filter);
needClearSelection && clearSelection();
toastr.success(t("Settings:AdministratorsAddedSuccessfully"));
});
@ -127,16 +133,15 @@ class PeopleStore {
if (type === "user") {
changeAdmins(userIDs, fullAccessId, false).then((res) => {
getUsersList(filter);
needFetchUsers && getUsersList(filter);
needClearSelection && clearSelection();
toastr.success(t("Settings:AdministratorsRemovedSuccessfully"));
});
}
};
onOpenInfoPanel = (item) => {
onOpenInfoPanel = () => {
const { setIsVisible } = this.infoPanelStore;
console.log(item);
setIsVisible(true);
};