pleroma/app/soapbox/api/hooks/groups/useGroupMutes.ts
2023-06-27 09:24:03 -04:00

25 lines
No EOL
661 B
TypeScript

import { Entities } from 'soapbox/entity-store/entities';
import { useEntities } from 'soapbox/entity-store/hooks';
import { useFeatures } from 'soapbox/hooks';
import { useApi } from 'soapbox/hooks/useApi';
import { groupSchema } from 'soapbox/schemas';
import type { Group } from 'soapbox/schemas';
function useGroupMutes() {
const api = useApi();
const features = useFeatures();
const { entities, ...result } = useEntities<Group>(
[Entities.GROUP_MUTES],
() => api.get('/api/v1/groups/mutes'),
{ schema: groupSchema, enabled: features.groupsMuting },
);
return {
...result,
mutes: entities,
};
}
export { useGroupMutes };