From dea803468f480155c12dd92dbdeec7a0611d07b9 Mon Sep 17 00:00:00 2001 From: Sol Fisher Romanoff Date: Thu, 16 Jun 2022 09:41:07 +0300 Subject: [PATCH] Show already added accounts in search --- src/components/list_edit/list_edit.js | 10 ++++++++-- src/components/list_new/list_new.js | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/list_edit/list_edit.js b/src/components/list_edit/list_edit.js index c3869885..5c1b36f1 100644 --- a/src/components/list_edit/list_edit.js +++ b/src/components/list_edit/list_edit.js @@ -20,7 +20,6 @@ const ListNew = { data () { return { title: '', - suggestions: [], userIds: [], selectedUserIds: [], loading: false, @@ -40,11 +39,18 @@ const ListNew = { users () { return this.userIds.map(userId => this.findUser(userId)) }, + selectedUsers () { + const users = this.selectedUserIds.map(userId => this.findUser(userId)) + if (users.includes(undefined)) { + return [] + } + return users + }, availableUsers () { if (this.query.length !== 0) { return this.users } else { - return this.suggestions + return this.selectedUsers } }, ...mapState({ diff --git a/src/components/list_new/list_new.js b/src/components/list_new/list_new.js index 86d354a8..d953712b 100644 --- a/src/components/list_new/list_new.js +++ b/src/components/list_new/list_new.js @@ -20,7 +20,6 @@ const ListNew = { data () { return { title: '', - suggestions: [], userIds: [], selectedUserIds: [], loading: false, @@ -31,11 +30,14 @@ const ListNew = { users () { return this.userIds.map(userId => this.findUser(userId)) }, + selectedUsers () { + return this.selectedUserIds.map(userId => this.findUser(userId)) + }, availableUsers () { if (this.query.length !== 0) { return this.users } else { - return this.suggestions + return this.selectedUsers } }, ...mapState({