mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 19:17:48 +00:00 
			
		
		
		
	 f71980bd95
			
		
	
	f71980bd95
	
	
	
		
			
			- Discard conflicting keys - Do not merge if there is already an identified contact Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
		
			
				
	
	
		
			29 lines
		
	
	
		
			774 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			774 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(userObject) {
 | |
|     return API.patch(buildUrl('widget/contact'), userObject);
 | |
|   },
 | |
|   setUser(identifier, userObject) {
 | |
|     return API.patch(buildUrl('widget/contact/set_user'), {
 | |
|       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],
 | |
|     });
 | |
|   },
 | |
| };
 |