environments/review-group-comp-s3yeyp/deployments/2859
Chewbacca 2023-03-14 12:55:42 -04:00
rodzic 9d1c2df1a2
commit 1d53f48904
1 zmienionych plików z 2 dodań i 9 usunięć

Wyświetl plik

@ -2,18 +2,11 @@ import { Entities } from 'soapbox/entity-store/entities';
import { useEntities } from 'soapbox/entity-store/hooks';
import { GroupMember, groupMemberSchema } from 'soapbox/schemas';
const parseGroupMember = (entity: unknown) => {
const result = groupMemberSchema.safeParse(entity);
if (result.success) {
return result.data;
}
};
function useGroupMembers(groupId: string, role: string) {
const { entities, ...result } = useEntities<GroupMember>(
[Entities.GROUP_MEMBERSHIPS, groupId, role],
`/api/v1/groups/${groupId}/memberships?role=${role}&limit=1`,
{ parser: parseGroupMember },
`/api/v1/groups/${groupId}/memberships?role=${role}`,
{ schema: groupMemberSchema },
);
return {