Trim protocol keyword names before creation [SCI-9388] (#7017)

This commit is contained in:
Soufiane 2024-01-30 14:34:34 +01:00 committed by GitHub
parent 2691fe91c6
commit e5384ee52a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -135,10 +135,11 @@ export default {
}); });
}, },
updateKeywords(keywords) { updateKeywords(keywords) {
const uniqueKeywords = [...new Set(keywords.map((kw) => kw.trim()).filter((kw) => !!kw))];
$.ajax({ $.ajax({
type: 'PATCH', type: 'PATCH',
url: this.protocol.attributes.urls.update_protocol_keywords_url, url: this.protocol.attributes.urls.update_protocol_keywords_url,
data: { keywords }, data: { keywords: uniqueKeywords },
success: (result) => { success: (result) => {
this.$emit('update', result.data.attributes); this.$emit('update', result.data.attributes);
} }