diff options
| author | Hakaba Hitoyo <hakabahitoyo@yahoo.co.jp> | 2019-01-16 02:33:08 +0000 |
|---|---|---|
| committer | HJ <spam@hjkos.com> | 2019-01-16 02:33:08 +0000 |
| commit | 05ead45fb72a3971b93ee544bba277aa167d69c5 (patch) | |
| tree | d008e723fa33597452caa7d27de4e330555b378b /src/components/who_to_follow | |
| parent | 502a76be0aa54edd23b4db58b3af90c57f0771cf (diff) | |
Show who to follow in the mobile view
Diffstat (limited to 'src/components/who_to_follow')
| -rw-r--r-- | src/components/who_to_follow/who_to_follow.js | 48 | ||||
| -rw-r--r-- | src/components/who_to_follow/who_to_follow.vue | 15 |
2 files changed, 63 insertions, 0 deletions
diff --git a/src/components/who_to_follow/who_to_follow.js b/src/components/who_to_follow/who_to_follow.js new file mode 100644 index 00000000..82098fc2 --- /dev/null +++ b/src/components/who_to_follow/who_to_follow.js @@ -0,0 +1,48 @@ +import apiService from '../../services/api/api.service.js' +import UserCard from '../user_card/user_card.vue' + +const WhoToFollow = { + components: { + UserCard + }, + data () { + return { + users: [] + } + }, + mounted () { + this.getWhoToFollow() + }, + methods: { + showWhoToFollow (reply) { + reply.forEach((i, index) => { + const user = { + id: 0, + name: i.display_name, + screen_name: i.acct, + profile_image_url: i.avatar || '/images/avi.png' + } + this.users.push(user) + + this.$store.state.api.backendInteractor.externalProfile(user.screen_name) + .then((externalUser) => { + if (!externalUser.error) { + this.$store.commit('addNewUsers', [externalUser]) + user.id = externalUser.id + } + }) + }) + }, + getWhoToFollow () { + const credentials = this.$store.state.users.currentUser.credentials + if (credentials) { + apiService.suggestions({credentials: credentials}) + .then((reply) => { + this.showWhoToFollow(reply) + }) + } + } + } +} + +export default WhoToFollow diff --git a/src/components/who_to_follow/who_to_follow.vue b/src/components/who_to_follow/who_to_follow.vue new file mode 100644 index 00000000..df2e03c8 --- /dev/null +++ b/src/components/who_to_follow/who_to_follow.vue @@ -0,0 +1,15 @@ +<template> + <div class="panel panel-default"> + <div class="panel-heading"> + {{$t('who_to_follow.who_to_follow')}} + </div> + <div class="panel-body"> + <user-card v-for="user in users" :key="user.id" :user="user" :showFollows="true"></user-card> + </div> + </div> +</template> + +<script src="./who_to_follow.js"></script> + +<style lang="scss"> +</style> |
