logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

who_to_follow.js (952B)


  1. import apiService from '../../services/api/api.service.js'
  2. import FollowCard from '../follow_card/follow_card.vue'
  3. const WhoToFollow = {
  4. components: {
  5. FollowCard
  6. },
  7. data () {
  8. return {
  9. users: []
  10. }
  11. },
  12. mounted () {
  13. this.getWhoToFollow()
  14. },
  15. methods: {
  16. showWhoToFollow (reply) {
  17. reply.forEach((i, index) => {
  18. this.$store.state.api.backendInteractor.fetchUser({ id: i.acct })
  19. .then((externalUser) => {
  20. if (!externalUser.error) {
  21. this.$store.commit('addNewUsers', [externalUser])
  22. this.users.push(externalUser)
  23. }
  24. })
  25. })
  26. },
  27. getWhoToFollow () {
  28. const credentials = this.$store.state.users.currentUser.credentials
  29. if (credentials) {
  30. apiService.suggestions({ credentials })
  31. .then((reply) => {
  32. this.showWhoToFollow(reply)
  33. })
  34. }
  35. }
  36. }
  37. }
  38. export default WhoToFollow