Make user finder more pleasant.
This commit is contained in:
parent
9c7eb1de3c
commit
5e6ffc0e45
3 changed files with 35 additions and 4 deletions
|
|
@ -1,20 +1,30 @@
|
|||
const UserFinder = {
|
||||
data: () => ({
|
||||
username: undefined,
|
||||
hidden: true
|
||||
hidden: true,
|
||||
error: false,
|
||||
loading: false
|
||||
}),
|
||||
methods: {
|
||||
findUser (username) {
|
||||
this.loading = true
|
||||
this.$store.state.api.backendInteractor.externalProfile(username)
|
||||
.then((user) => {
|
||||
this.loading = false
|
||||
this.hidden = true
|
||||
if (!user.error) {
|
||||
this.$store.commit('addNewUsers', [user])
|
||||
this.$router.push({name: 'user-profile', params: {id: user.id}})
|
||||
} else {
|
||||
this.error = true
|
||||
}
|
||||
})
|
||||
},
|
||||
toggleHidden () {
|
||||
this.hidden = !this.hidden
|
||||
},
|
||||
dismissError () {
|
||||
this.error = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue