refactoring
This commit is contained in:
parent
2c2d4001e7
commit
3bac675e44
@ -33,8 +33,8 @@ const DisableUserDialog = ({
|
|||||||
const onClickDisableUser = async () => {
|
const onClickDisableUser = async () => {
|
||||||
try {
|
try {
|
||||||
await updateUserStatus(EmployeeStatus.Disabled, userIds);
|
await updateUserStatus(EmployeeStatus.Disabled, userIds);
|
||||||
toastr.success(t("PeopleTranslations:SuccessChangeUserStatus"));
|
|
||||||
await fetchData();
|
await fetchData();
|
||||||
|
toastr.success(t("PeopleTranslations:SuccessChangeUserStatus"));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toastr.error(error);
|
toastr.error(error);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -596,7 +596,7 @@ class SelectionStore {
|
|||||||
|
|
||||||
updateDataFromSocket = (data) => {
|
updateDataFromSocket = (data) => {
|
||||||
const newArr = [...this.dataFromSocket];
|
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(
|
const currentSesstionIndex = this.sessionsData.findIndex(
|
||||||
({ id }) => id === data.id,
|
({ id }) => id === data.id,
|
||||||
);
|
);
|
||||||
@ -609,13 +609,13 @@ class SelectionStore {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indexTest === -1) {
|
if (index === -1) {
|
||||||
this.dataFromSocket = [...this.dataFromSocket, data];
|
this.dataFromSocket = [...this.dataFromSocket, data];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
newArr[indexTest] = {
|
newArr[index] = {
|
||||||
...newArr[indexTest],
|
...newArr[index],
|
||||||
sessions,
|
sessions,
|
||||||
status,
|
status,
|
||||||
};
|
};
|
||||||
@ -628,8 +628,7 @@ class SelectionStore {
|
|||||||
const isCurrentSesstion = session.id === data?.id;
|
const isCurrentSesstion = session.id === data?.id;
|
||||||
const connectionsIsEmpty = session.connections.length === 0;
|
const connectionsIsEmpty = session.connections.length === 0;
|
||||||
|
|
||||||
const lastIndex = -1;
|
const sessionData = data.sessions?.at(-1);
|
||||||
const sessionData = data.sessions?.at(lastIndex);
|
|
||||||
if (isCurrentSesstion) return [{ ...first, ...sessionData }, ...other];
|
if (isCurrentSesstion) return [{ ...first, ...sessionData }, ...other];
|
||||||
|
|
||||||
if (connectionsIsEmpty) {
|
if (connectionsIsEmpty) {
|
||||||
|
Loading…
Reference in New Issue
Block a user