refactoring

This commit is contained in:
Elyor Djalilov 2024-07-04 15:40:53 +05:00
parent 2c2d4001e7
commit 3bac675e44
2 changed files with 6 additions and 7 deletions

View File

@ -33,8 +33,8 @@ const DisableUserDialog = ({
const onClickDisableUser = async () => {
try {
await updateUserStatus(EmployeeStatus.Disabled, userIds);
toastr.success(t("PeopleTranslations:SuccessChangeUserStatus"));
await fetchData();
toastr.success(t("PeopleTranslations:SuccessChangeUserStatus"));
} catch (error) {
toastr.error(error);
} finally {

View File

@ -596,7 +596,7 @@ class SelectionStore {
updateDataFromSocket = (data) => {
const newArr = [...this.dataFromSocket];
const indexTest = newArr.findIndex(({ id }) => id === data.id);
const index = newArr.findIndex(({ id }) => id === data.id);
const currentSesstionIndex = this.sessionsData.findIndex(
({ id }) => id === data.id,
);
@ -609,13 +609,13 @@ class SelectionStore {
};
}
if (indexTest === -1) {
if (index === -1) {
this.dataFromSocket = [...this.dataFromSocket, data];
return;
}
newArr[indexTest] = {
...newArr[indexTest],
newArr[index] = {
...newArr[index],
sessions,
status,
};
@ -628,8 +628,7 @@ class SelectionStore {
const isCurrentSesstion = session.id === data?.id;
const connectionsIsEmpty = session.connections.length === 0;
const lastIndex = -1;
const sessionData = data.sessions?.at(lastIndex);
const sessionData = data.sessions?.at(-1);
if (isCurrentSesstion) return [{ ...first, ...sessionData }, ...other];
if (connectionsIsEmpty) {