aboutsummaryrefslogtreecommitdiff
path: root/src/components/user_finder/user_finder.js
blob: 0320538224a86add16e9166b952977bfbd7cca55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const UserFinder = {
  data: () => ({
    username: undefined,
    hidden: true
  }),
  methods: {
    findUser (username) {
      this.$store.state.api.backendInteractor.externalProfile(username)
        .then((user) => {
          if (!user.error) {
            this.$store.commit('addNewUsers', [user])
            this.$router.push({name: 'user-profile', params: {id: user.id}})
          }
        })
    },
    toggleHidden () {
      this.hidden = !this.hidden
    }
  }
}

export default UserFinder