feat: Render contact custom attributes in contact/conversation sidebar (#3310)
This commit is contained in:
@@ -6,8 +6,8 @@ class AttributeAPI extends ApiClient {
|
||||
super('custom_attribute_definitions', { accountScoped: true });
|
||||
}
|
||||
|
||||
getAttributesByModel(modelId) {
|
||||
return axios.get(`${this.url}?attribute_model=${modelId}`);
|
||||
getAttributesByModel() {
|
||||
return axios.get(this.url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,12 @@ class ContactAPI extends ApiClient {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
});
|
||||
}
|
||||
|
||||
destroyCustomAttributes(contactId, customAttributes) {
|
||||
return axios.post(`${this.url}/${contactId}/destroy_custom_attributes`, {
|
||||
custom_attributes: customAttributes,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default new ContactAPI();
|
||||
|
||||
@@ -60,6 +60,16 @@ describe('#ContactsAPI', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('#destroyCustomAttributes', () => {
|
||||
contactAPI.destroyCustomAttributes(1, ['cloudCustomer']);
|
||||
expect(context.axiosMock.post).toHaveBeenCalledWith(
|
||||
'/api/v1/contacts/1/destroy_custom_attributes',
|
||||
{
|
||||
custom_attributes: ['cloudCustomer'],
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('#importContacts', () => {
|
||||
const file = 'file';
|
||||
contactAPI.importContacts(file);
|
||||
|
||||
Reference in New Issue
Block a user