Do not make requests to api/v1/groups if fffeature not available
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
3a94736285
commit
7329c0bf25
1 changed files with 5 additions and 1 deletions
|
@ -5,11 +5,15 @@ import { useEntities, useEntity } from 'soapbox/entity-store/hooks';
|
|||
import { groupSchema, Group } from 'soapbox/schemas/group';
|
||||
import { groupRelationshipSchema, GroupRelationship } from 'soapbox/schemas/group-relationship';
|
||||
|
||||
import { useFeatures } from './useFeatures';
|
||||
|
||||
function useGroups() {
|
||||
const features = useFeatures();
|
||||
|
||||
const { entities, ...result } = useEntities<Group>(
|
||||
[Entities.GROUPS, ''],
|
||||
'/api/v1/groups',
|
||||
{ schema: groupSchema },
|
||||
{ enabled: features.groups, schema: groupSchema },
|
||||
);
|
||||
const { relationships } = useGroupRelationships(entities.map(entity => entity.id));
|
||||
|
||||
|
|
Loading…
Reference in a new issue