|
|
@@ -21,10 +21,11 @@ export const useSWRxUserGroupList = (initialData?: IUserGroupHasId[]): SWRRespon
|
|
|
};
|
|
|
|
|
|
export const useSWRxChildUserGroupList = (
|
|
|
- parentIds: string[] | undefined, includeGrandChildren?: boolean, initialData?: IUserGroupHasId[],
|
|
|
+ parentIds?: string[], includeGrandChildren?: boolean, initialData?: IUserGroupHasId[],
|
|
|
): SWRResponse<IUserGroupHasId[], Error> => {
|
|
|
+ const shouldFetch = parentIds != null && parentIds.length > 0;
|
|
|
return useSWRImmutable<IUserGroupHasId[], Error>(
|
|
|
- parentIds != null ? ['/user-groups/children', parentIds, includeGrandChildren] : null,
|
|
|
+ shouldFetch ? ['/user-groups/children', parentIds, includeGrandChildren] : null,
|
|
|
(endpoint, parentIds, includeGrandChildren) => apiv3Get<ChildUserGroupListResult>(
|
|
|
endpoint, { parentIds, includeGrandChildren },
|
|
|
).then(result => result.data.childUserGroups),
|