pleroma-fe/src/components/who_to_follow/who_to_follow.js

41 lines
952 B
JavaScript
Raw Normal View History

2019-01-16 03:33:08 +01:00
import apiService from '../../services/api/api.service.js'
import FollowCard from '../follow_card/follow_card.vue'
2019-01-16 03:33:08 +01:00
const WhoToFollow = {
components: {
FollowCard
2019-01-16 03:33:08 +01:00
},
data () {
return {
users: []
}
},
mounted () {
this.getWhoToFollow()
},
methods: {
showWhoToFollow (reply) {
reply.forEach((i, index) => {
this.$store.state.api.backendInteractor.fetchUser({ id: i.acct })
2019-01-16 03:33:08 +01:00
.then((externalUser) => {
if (!externalUser.error) {
this.$store.commit('addNewUsers', [externalUser])
this.users.push(externalUser)
2019-01-16 03:33:08 +01:00
}
})
})
},
getWhoToFollow () {
const credentials = this.$store.state.users.currentUser.credentials
if (credentials) {
2022-07-31 11:35:48 +02:00
apiService.suggestions({ credentials })
2019-01-16 03:33:08 +01:00
.then((reply) => {
this.showWhoToFollow(reply)
})
}
}
}
}
export default WhoToFollow