Refactor user search api, better api error response handling
This commit is contained in:
parent
2f87540612
commit
532b76eb64
7 changed files with 31 additions and 79 deletions
|
@ -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 })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue