FollowSuggestions.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <style scoped>
  2. </style>
  3. <template>
  4. <div class="card mb-4">
  5. <div class="card-header bg-white">
  6. <span class="font-weight-bold h5">Who to follow</span>
  7. <span class="small float-right font-weight-bold">
  8. <a href="javascript:void(0);" class="pr-2" v-on:click="fetchData">Refresh</a>
  9. </span>
  10. </div>
  11. <div class="card-body">
  12. <div v-if="results.length == 0">
  13. <p class="mb-0 font-weight-bold">You are not following anyone yet, try the <a href="/discover">discover</a> feature to find users to follow.</p>
  14. </div>
  15. <div v-for="(user, index) in results">
  16. <div class="media " style="width:100%">
  17. <img class="mr-3" :src="user.avatar" width="40px">
  18. <div class="media-body" style="width:70%">
  19. <p class="my-0 font-weight-bold text-truncate" style="text-overflow: hidden">{{user.acct}} <span class="text-muted font-weight-normal">&commat;{{user.username}}</span></p>
  20. <a class="btn btn-outline-primary px-3 py-0" :href="user.url" style="border-radius:20px;">Follow</a>
  21. </div>
  22. </div>
  23. <div v-if="index != results.length - 1"><hr></div>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {
  32. results: {},
  33. };
  34. },
  35. mounted() {
  36. this.fetchData();
  37. },
  38. methods: {
  39. fetchData() {
  40. axios.get('/api/local/i/follow-suggestions')
  41. .then(response => {
  42. this.results = response.data;
  43. });
  44. }
  45. }
  46. }
  47. </script>