chore: Clean up

This commit is contained in:
iamsivin
2024-11-15 17:22:48 +05:30
parent 28481c45cb
commit 7cc0d6d457
4 changed files with 154 additions and 27 deletions
@@ -131,7 +131,32 @@ export const prepareWhatsAppMessagePayload = ({
};
};
export const generateContactQuery = ({ query }) => {
return {
payload: [
{
attribute_key: 'email',
filter_operator: 'contains',
values: [query],
attribute_model: 'standard',
custom_attribute_type: '',
},
],
};
};
// API Calls
export const searchContacts = async query => {
const {
data: { payload },
} = await ContactAPI.filter(
undefined,
'name',
generateContactQuery({ query })
);
return camelcaseKeys(payload, { deep: true });
};
export const createNewContact = async email => {
const payload = {
name: getCapitalizedNameFromEmail(email),