import { Entities } from 'soapbox/entity-store/entities'; import { useCreateEntity } from 'soapbox/entity-store/hooks'; import { useApi, useOwnAccount } from 'soapbox/hooks'; import type { Group } from 'soapbox/schemas'; function useCancelMembershipRequest(group: Group) { const api = useApi(); const me = useOwnAccount(); const { createEntity, isLoading } = useCreateEntity( [Entities.GROUP_RELATIONSHIPS], () => api.post(`/api/v1/groups/${group.id}/membership_requests/${me?.id}/reject`), ); return { mutate: createEntity, isLoading, }; } export { useCancelMembershipRequest };