|
|
@@ -6,7 +6,8 @@ import { apiv3Get } from '~/client/util/apiv3-client';
|
|
|
import { IPageHasId } from '~/interfaces/page';
|
|
|
import { IUserGroupHasId, IUserGroupRelationHasId } from '~/interfaces/user';
|
|
|
import {
|
|
|
- UserGroupListResult, ChildUserGroupListResult, UserGroupRelationListResult, UserGroupPagesResult, SelectableUserGroupsResult, AncestorUserGroupsResult,
|
|
|
+ UserGroupListResult, ChildUserGroupListResult, UserGroupRelationListResult,
|
|
|
+ UserGroupPagesResult, SelectableParentUserGroupsResult, SelectableUserGroupsResult, AncestorUserGroupsResult,
|
|
|
} from '~/interfaces/user-group-response';
|
|
|
|
|
|
|
|
|
@@ -60,6 +61,13 @@ export const useSWRxUserGroupPages = (groupId: string | undefined, limit: number
|
|
|
);
|
|
|
};
|
|
|
|
|
|
+export const useSWRxSelectableParentUserGroups = (groupId: string | undefined): SWRResponse<IUserGroupHasId[], Error> => {
|
|
|
+ return useSWRImmutable(
|
|
|
+ groupId != null ? ['/user-groups/selectable-parent-groups', groupId] : null,
|
|
|
+ endpoint => apiv3Get<SelectableParentUserGroupsResult>(endpoint, { groupId }).then(result => result.data.selectableParentGroups),
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
export const useSWRxSelectableUserGroups = (groupId: string | undefined): SWRResponse<IUserGroupHasId[], Error> => {
|
|
|
return useSWRImmutable(
|
|
|
groupId != null ? ['/user-groups/selectable-groups'] : null,
|