sforkowany z mirror/soapbox
Merge branch 'use-groups-condition' into 'develop'
Do not make requests to api/v1/groups if feature not available See merge request soapbox-pub/soapbox!2363develop^2
commit
282afaa47f
|
@ -5,11 +5,15 @@ import { useEntities, useEntity } from 'soapbox/entity-store/hooks';
|
||||||
import { groupSchema, Group } from 'soapbox/schemas/group';
|
import { groupSchema, Group } from 'soapbox/schemas/group';
|
||||||
import { groupRelationshipSchema, GroupRelationship } from 'soapbox/schemas/group-relationship';
|
import { groupRelationshipSchema, GroupRelationship } from 'soapbox/schemas/group-relationship';
|
||||||
|
|
||||||
|
import { useFeatures } from './useFeatures';
|
||||||
|
|
||||||
function useGroups() {
|
function useGroups() {
|
||||||
|
const features = useFeatures();
|
||||||
|
|
||||||
const { entities, ...result } = useEntities<Group>(
|
const { entities, ...result } = useEntities<Group>(
|
||||||
[Entities.GROUPS, ''],
|
[Entities.GROUPS, ''],
|
||||||
'/api/v1/groups',
|
'/api/v1/groups',
|
||||||
{ schema: groupSchema },
|
{ enabled: features.groups, schema: groupSchema },
|
||||||
);
|
);
|
||||||
const { relationships } = useGroupRelationships(entities.map(entity => entity.id));
|
const { relationships } = useGroupRelationships(entities.map(entity => entity.id));
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue