From e304af064bded464647680dad0bcb46901d8c58b Mon Sep 17 00:00:00 2001 From: Artem Tarasov Date: Mon, 5 Apr 2021 16:18:41 +0300 Subject: [PATCH] Web: People: fixed group list query --- packages/asc-web-common/api/groups/index.js | 4 ++-- products/ASC.People/Client/src/store/GroupsStore.js | 2 +- .../ASC.People/Client/src/store/SelectedGroupStore.js | 11 +++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/asc-web-common/api/groups/index.js b/packages/asc-web-common/api/groups/index.js index 11ff3d0f31..b86b719e62 100644 --- a/packages/asc-web-common/api/groups/index.js +++ b/packages/asc-web-common/api/groups/index.js @@ -44,9 +44,9 @@ export function deleteGroup(id) { }); } -export function getGroupListFull() { +/*export function getGroupListFull() { return request({ method: "get", url: "/group/full", }); -} +}*/ //TODO: use after fixing problems on the server diff --git a/products/ASC.People/Client/src/store/GroupsStore.js b/products/ASC.People/Client/src/store/GroupsStore.js index 04a01d0745..6c6e238f40 100644 --- a/products/ASC.People/Client/src/store/GroupsStore.js +++ b/products/ASC.People/Client/src/store/GroupsStore.js @@ -16,7 +16,7 @@ class GroupsStore { } getGroupList = async () => { - const res = await api.groups.getGroupListFull(); + const res = await api.groups.getGroupList(); //TODO: replace with getGroupListFull() after fixing problems on the server this.groups = res; }; diff --git a/products/ASC.People/Client/src/store/SelectedGroupStore.js b/products/ASC.People/Client/src/store/SelectedGroupStore.js index ae9bb99d55..312aa6cea8 100644 --- a/products/ASC.People/Client/src/store/SelectedGroupStore.js +++ b/products/ASC.People/Client/src/store/SelectedGroupStore.js @@ -59,8 +59,15 @@ class SelectedGroupStore { const { group, search, role, activationStatus, employeeStatus } = filter; let countMembers; - groups.filter((el) => { - if (el.id === group) countMembers = el.members.length; + groups.filter(async (el) => { + if (el.id === group) { + if (!el.members) { + const currGroup = await getGroup(el.id); + countMembers = currGroup.members.length; // TODO: simplify after fixing server issues with getGroupListFull + } else { + countMembers = el.members.length; + } + } }); const filterIsClear =