From 532b76eb64119848d424d6d0d644a72d817fba59 Mon Sep 17 00:00:00 2001 From: Tae Hoon Date: Wed, 10 Jul 2019 16:58:49 +0000 Subject: Refactor user search api, better api error response handling --- src/components/user_search/user_search.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src/components/user_search/user_search.js') diff --git a/src/components/user_search/user_search.js b/src/components/user_search/user_search.js index 62dafdf1..5c29d8f2 100644 --- a/src/components/user_search/user_search.js +++ b/src/components/user_search/user_search.js @@ -35,15 +35,13 @@ const userSearch = { }, search (query) { if (!query) { - this.users = [] return } this.loading = true + this.userIds = [] this.$store.dispatch('searchUsers', query) - .then((res) => { - this.loading = false - this.userIds = map(res, 'id') - }) + .then((res) => { this.userIds = map(res, 'id') }) + .finally(() => { this.loading = false }) } } } -- cgit v1.2.3-70-g09d2