Skip to content

Commit

Permalink
Merge pull request #561 from weni-ai/hotfix/discussions-filter
Browse files Browse the repository at this point in the history
[ENGAGE-2101] - Fix discussions filter
  • Loading branch information
mateuseduardomedeiros authored Nov 19, 2024
2 parents 17afdc7 + a9b96e6 commit f041bc5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/layouts/ChatsLayout/components/TheCardGroups/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export default {
this.timerId = setTimeout(() => {
this.page = 0;
this.listRoom(false);
this.listDiscussions();
if (newNameOfContact) {
this.isSearching = true;
} else {
Expand Down Expand Up @@ -267,7 +268,10 @@ export default {
async listDiscussions() {
try {
const { viewedAgent } = this;
await this.getAllDiscussion({ viewedAgent });
await this.getAllDiscussion({
viewedAgent,
filters: { search: this.nameOfContact },
});
} catch {
console.error('Não foi possível listar as discussões');
}
Expand Down
3 changes: 2 additions & 1 deletion src/services/api/resources/chats/discussion.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ export default {
);
return response.data;
},
async listAll({ viewedAgent }) {
async listAll({ viewedAgent, filters = {} }) {
const params = {
project: getProject() || '',
is_active: true,
limit: 9999,
...filters,
};

if (viewedAgent) {
Expand Down
4 changes: 2 additions & 2 deletions src/store/modules/chats/discussions.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export const useDiscussions = defineStore('discussions', {
};
},

async getAll({ viewedAgent }) {
const newDiscussions = await Discussion.listAll({ viewedAgent });
async getAll({ viewedAgent, filters }) {
const newDiscussions = await Discussion.listAll({ viewedAgent, filters });
this.setDiscussions(newDiscussions?.results);
},

Expand Down

0 comments on commit f041bc5

Please sign in to comment.