chore: Update deleteCustomAttribute
method in SDK (#3334)
This commit is contained in:
parent
c2db8a1fd7
commit
a2764e5c1d
12 changed files with 138 additions and 30 deletions
|
@ -262,9 +262,10 @@ export default {
|
|||
message.customAttributes
|
||||
);
|
||||
} else if (message.event === 'delete-custom-attribute') {
|
||||
this.$store.dispatch('contacts/setCustomAttributes', {
|
||||
[message.customAttribute]: null,
|
||||
});
|
||||
this.$store.dispatch(
|
||||
'contacts/deleteCustomAttribute',
|
||||
message.customAttribute
|
||||
);
|
||||
} else if (message.event === 'set-locale') {
|
||||
this.setLocale(message.locale);
|
||||
this.setBubbleLabel();
|
||||
|
|
|
@ -12,9 +12,14 @@ export default {
|
|||
...userObject,
|
||||
});
|
||||
},
|
||||
setCustomAttibutes(customAttributes = {}) {
|
||||
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],
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
|
@ -43,14 +43,21 @@ export const actions = {
|
|||
|
||||
refreshActionCableConnector(pubsubToken);
|
||||
} catch (error) {
|
||||
// Ingore error
|
||||
// Ignore error
|
||||
}
|
||||
},
|
||||
setCustomAttributes: async (_, customAttributes = {}) => {
|
||||
try {
|
||||
await ContactsAPI.setCustomAttibutes(customAttributes);
|
||||
await ContactsAPI.setCustomAttributes(customAttributes);
|
||||
} catch (error) {
|
||||
// Ingore error
|
||||
// Ignore error
|
||||
}
|
||||
},
|
||||
deleteCustomAttribute: async (_, customAttribute) => {
|
||||
try {
|
||||
await ContactsAPI.deleteCustomAttribute(customAttribute);
|
||||
} catch (error) {
|
||||
// Ignore error
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue