2023-03-15 11:53:17 -07:00
|
|
|
import { Entities } from 'soapbox/entity-store/entities';
|
|
|
|
import { useEntityActions } from 'soapbox/entity-store/hooks';
|
|
|
|
|
2023-06-05 05:34:22 -07:00
|
|
|
import type { Account, Group, GroupMember } from 'soapbox/schemas';
|
2023-03-15 11:53:17 -07:00
|
|
|
|
2023-06-05 05:34:22 -07:00
|
|
|
function useBlockGroupMember(group: Group, account: Account) {
|
2023-03-17 11:20:03 -07:00
|
|
|
const { createEntity } = useEntityActions<GroupMember>(
|
2023-06-05 05:34:22 -07:00
|
|
|
[Entities.GROUP_MEMBERSHIPS, account.id],
|
|
|
|
{ post: `/api/v1/groups/${group?.id}/blocks` },
|
2023-03-15 11:53:17 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
return createEntity;
|
|
|
|
}
|
|
|
|
|
|
|
|
export { useBlockGroupMember };
|