25 lines
674 B
JavaScript
25 lines
674 B
JavaScript
import { API } from 'widget/helpers/axios';
|
|
|
|
const buildUrl = endPoint => `/api/v1/${endPoint}${window.location.search}`;
|
|
|
|
export default {
|
|
get() {
|
|
return API.get(buildUrl('widget/contact'));
|
|
},
|
|
update(identifier, userObject) {
|
|
return API.patch(buildUrl('widget/contact'), {
|
|
identifier,
|
|
...userObject,
|
|
});
|
|
},
|
|
setCustomAttributes(customAttributes = {}) {
|
|
return API.patch(buildUrl('widget/contact'), {
|
|
custom_attributes: customAttributes,
|
|
});
|
|
},
|
|
deleteCustomAttribute(customAttribute) {
|
|
return API.post(buildUrl('widget/contact/destroy_custom_attributes'), {
|
|
custom_attributes: [customAttribute],
|
|
});
|
|
},
|
|
};
|