2020-04-03 07:34:58 +00:00
|
|
|
import { API } from 'widget/helpers/axios';
|
|
|
|
|
|
|
|
const buildUrl = endPoint => `/api/v1/${endPoint}${window.location.search}`;
|
|
|
|
|
|
|
|
export default {
|
2021-03-20 12:14:20 +00:00
|
|
|
get() {
|
|
|
|
return API.get(buildUrl('widget/contact'));
|
|
|
|
},
|
2020-04-03 07:34:58 +00:00
|
|
|
update(identifier, userObject) {
|
|
|
|
return API.patch(buildUrl('widget/contact'), {
|
|
|
|
identifier,
|
|
|
|
...userObject,
|
|
|
|
});
|
|
|
|
},
|
2021-11-15 09:26:35 +00:00
|
|
|
setCustomAttributes(customAttributes = {}) {
|
2020-08-21 14:00:27 +00:00
|
|
|
return API.patch(buildUrl('widget/contact'), {
|
|
|
|
custom_attributes: customAttributes,
|
|
|
|
});
|
|
|
|
},
|
2021-11-15 09:26:35 +00:00
|
|
|
deleteCustomAttribute(customAttribute) {
|
|
|
|
return API.post(buildUrl('widget/contact/destroy_custom_attributes'), {
|
|
|
|
custom_attributes: [customAttribute],
|
|
|
|
});
|
|
|
|
},
|
2020-04-03 07:34:58 +00:00
|
|
|
};
|