Skip to content

Commit

Permalink
Add graphQL call to fetch contact's sources
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-bizz committed Dec 5, 2024
1 parent 9ed8cb2 commit 3a61a72
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ export const ContactDetailsMoreAcitions: React.FC<
setOpen={setDeleteModalOpen}
deleting={deleting}
deleteContact={handleDeleteContact}
contactId={contactId}
/>
)}
{openHideModal && (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
query ContactSource($accountListId: ID!, $contactId: ID!) {
contact(accountListId: $accountListId, id: $contactId) {
id
source
addresses {
nodes {
source
}
}
people {
nodes {
emailAddresses {
nodes {
source
}
}
phoneNumbers {
nodes {
source
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
DeleteButton,
} from 'src/components/common/Modal/ActionButtons/ActionButtons';
import Modal from 'src/components/common/Modal/Modal';
import { useAccountListId } from 'src/hooks/useAccountListId';

const LoadingIndicator = styled(CircularProgress)(({ theme }) => ({
margin: theme.spacing(0, 1, 0, 0),
Expand All @@ -22,15 +23,23 @@ interface DeleteContactModalProps {
setOpen: (open: boolean) => void;
deleting: boolean;
deleteContact: () => void;
contactId: string;
}

export const DeleteContactModal: React.FC<DeleteContactModalProps> = ({
open,
setOpen,
deleting,
deleteContact,
contactId,
}) => {
const { t } = useTranslation();
const accountListId = useAccountListId() ?? '';

const { data } = useContactSourceQuery({
variables: { accountListId, contactId },
skip: !open && !contactId,
});
return (
<Modal
isOpen={open}
Expand Down

0 comments on commit 3a61a72

Please sign in to comment.