Shun Miyazawa 4 anos atrás
pai
commit
594adf6915

+ 3 - 3
packages/app/src/server/routes/apiv3/user-group.js

@@ -93,11 +93,11 @@ module.exports = (crowi) => {
   // TODO 85062: improve sort
   router.get('/children', loginRequiredStrictly, adminRequired, validator.listChildren, async(req, res) => {
     try {
-      const { parentIds, includeGrandChildren = false } = req.query;
+      const { parentIdsJoinedByComma, includeGrandChildren = false } = req.query;
 
       let parentIdList = [];
-      if (parentIds != null) {
-        parentIdList = parentIds
+      if (parentIdsJoinedByComma != null) {
+        parentIdList = parentIdsJoinedByComma
           .split(',')
           .filter(parentId => parentId !== '');
       }

+ 2 - 2
packages/app/src/stores/user-group.tsx

@@ -25,9 +25,9 @@ export const useSWRxChildUserGroupList = (
 ): SWRResponse<IUserGroupHasId[], Error> => {
   const shouldFetch = parentIds != null && parentIds.join() !== '';
   return useSWRImmutable<IUserGroupHasId[], Error>(
-    shouldFetch ? ['/user-groups/children', parentIds.join(), includeGrandChildren] : null,
+    shouldFetch ? ['/user-groups/children', parentIds, includeGrandChildren] : null,
     (endpoint, parentIds, includeGrandChildren) => apiv3Get<ChildUserGroupListResult>(
-      endpoint, { parentIds, includeGrandChildren },
+      endpoint, { parentIdsJoinedByComma: parentIds.join(','), includeGrandChildren },
     ).then(result => result.data.childUserGroups),
     {
       fallbackData: initialData,