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