diff options
| author | shpuld <shp@cock.li> | 2019-02-03 11:58:49 +0200 |
|---|---|---|
| committer | shpuld <shp@cock.li> | 2019-02-03 11:58:49 +0200 |
| commit | 18ae7bd5f366598d46a65e9da1312c98f7bb00e7 (patch) | |
| tree | b876f85bc711b21b2d77d8db49454755f1f1fbb0 /src/components/friends_list | |
| parent | b614cb94e502f3491afd07e5bcb785ad122cf100 (diff) | |
Combine friends/followers
Diffstat (limited to 'src/components/friends_list')
| -rw-r--r-- | src/components/friends_list/friends_list.js | 61 | ||||
| -rw-r--r-- | src/components/friends_list/friends_list.vue | 12 |
2 files changed, 0 insertions, 73 deletions
diff --git a/src/components/friends_list/friends_list.js b/src/components/friends_list/friends_list.js deleted file mode 100644 index d5c1837a..00000000 --- a/src/components/friends_list/friends_list.js +++ /dev/null @@ -1,61 +0,0 @@ -import UserCard from '../user_card/user_card.vue' - -const FriendsList = { - data () { - return { - loading: false, - bottomedOut: false, - error: false - } - }, - props: ['userId'], - created () { - window.addEventListener('scroll', this.scrollLoad) - if (this.user.followers.length === 0) { - this.fetchFriends() - } - }, - destroyed () { - window.removeEventListener('scroll', this.scrollLoad) - this.$store.dispatch('clearFriendsAndFollowers', this.userId) - }, - computed: { - user () { - return this.$store.getters.userById(this.userId) - }, - friends () { - return this.user.friends - } - }, - methods: { - fetchFriends () { - if (!this.loading) { - this.loading = true - this.$store.dispatch('addFriends', this.userId).then(friends => { - this.error = false - this.loading = false - this.bottomedOut = friends.length === 0 - }).catch(() => { - this.error = true - this.loading = false - }) - } - }, - scrollLoad (e) { - const bodyBRect = document.body.getBoundingClientRect() - const height = Math.max(bodyBRect.height, -(bodyBRect.y)) - if (this.loading === false && - this.bottomedOut === false && - this.$el.offsetHeight > 0 && - (window.innerHeight + window.pageYOffset) >= (height - 750) - ) { - this.fetchFriends() - } - } - }, - components: { - UserCard - } -} - -export default FriendsList diff --git a/src/components/friends_list/friends_list.vue b/src/components/friends_list/friends_list.vue deleted file mode 100644 index 75657cc8..00000000 --- a/src/components/friends_list/friends_list.vue +++ /dev/null @@ -1,12 +0,0 @@ -<template> - <div> - <user-card v-for="friend in friends" :key="friend.id" :user="friend" :showFollows="true"></user-card> - <div @click="fetchFriends" class="new-status-notification text-center panel-footer"> - <span v-if="error" class="alert error">Error loading follows</span> - <i v-else-if="loading" class="icon-spin3 animate-spin"/> - <span v-else-if="bottomedOut"></span> - </div> - </div> -</template> - -<script src="./friends_list.js" /> |
