Add actual user search.
This commit is contained in:
parent
609ad40736
commit
c34eebff6c
8 changed files with 103 additions and 22 deletions
33
src/components/user_search/user_search.js
Normal file
33
src/components/user_search/user_search.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
import UserCard from '../user_card/user_card.vue'
|
||||
import userSearchApi from '../../services/new_api/user_search.js'
|
||||
const userSearch = {
|
||||
components: {
|
||||
UserCard
|
||||
},
|
||||
props: [
|
||||
'query'
|
||||
],
|
||||
data () {
|
||||
return {
|
||||
users: []
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.search(this.query)
|
||||
},
|
||||
watch: {
|
||||
query (newV) {
|
||||
this.search(newV)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
search (query) {
|
||||
userSearchApi.search({query, store: this.$store})
|
||||
.then((res) => {
|
||||
this.users = res
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default userSearch
|
Loading…
Add table
Add a link
Reference in a new issue