diff --git a/src/modules/contacts/api/ContactsAPI.js b/src/modules/contacts/api/ContactsAPI.js index acd02685..27cd17db 100644 --- a/src/modules/contacts/api/ContactsAPI.js +++ b/src/modules/contacts/api/ContactsAPI.js @@ -42,6 +42,9 @@ const getList = async (params) => { } else if (params[SearchMode.ABOUT]) { searchValue = params[SearchMode.ABOUT]; searchKey = SearchMode.ABOUT; + } else if (params[SearchMode.VARIABLES]) { + searchValue = params[SearchMode.VARIABLES]; + searchKey = SearchMode.VARIABLES; } const changedParams = { @@ -50,6 +53,17 @@ const getList = async (params) => { qin: searchKey, }; + const transformations = [ + sanitize(fieldsToSend), + merge(getDefaultGetParams()), + camelToSnake(), + ]; + + // This code needed for adding starToSearch method to applyTransform while searchKey !== SearchMode.VARIABLES because '*' in variables search mode brokes backend logic. + if (searchKey !== SearchMode.VARIABLES) { + transformations.push(starToSearch('q')); + } + const { page, size, @@ -58,12 +72,8 @@ const getList = async (params) => { fields, id, qin, - } = applyTransform(changedParams, [ - sanitize(fieldsToSend), - merge(getDefaultGetParams()), - starToSearch('q'), - camelToSnake(), - ]); + } = applyTransform(changedParams, transformations); + try { const response = await service.searchContacts( page, diff --git a/src/modules/contacts/modules/filters/components/filter-search.vue b/src/modules/contacts/modules/filters/components/filter-search.vue index fe5ffa28..b977b301 100644 --- a/src/modules/contacts/modules/filters/components/filter-search.vue +++ b/src/modules/contacts/modules/filters/components/filter-search.vue @@ -1,13 +1,16 @@