1
0

Refactoring

This commit is contained in:
syuilo
2019-05-21 03:07:11 +09:00
parent 262d5ead51
commit 5511b6e013
41 changed files with 764 additions and 1408 deletions
@@ -1,7 +1,5 @@
<template>
<div>
<mk-user-list :make-promise="makePromise">{{ $t('@.followers') }}</mk-user-list>
</div>
<mk-user-list :pagination="pagination" :extract="items => items.map(item => item.follower)">{{ $t('@.followers') }}</mk-user-list>
</template>
<script lang="ts">
@@ -9,31 +7,18 @@ import Vue from 'vue';
import parseAcct from '../../../../../misc/acct/parse';
import i18n from '../../../i18n';
const fetchLimit = 30;
export default Vue.extend({
i18n: i18n(),
data() {
return {
makePromise: cursor => this.$root.api('users/followers', {
...parseAcct(this.$route.params.user),
limit: fetchLimit + 1,
untilId: cursor ? cursor : undefined,
}).then(followings => {
if (followings.length == fetchLimit + 1) {
followings.pop();
return {
users: followings.map(following => following.follower),
cursor: followings[followings.length - 1].id
};
} else {
return {
users: followings.map(following => following.follower),
more: false
};
pagination: {
endpoint: 'users/followers',
limit: 30,
params: {
...parseAcct(this.$route.params.user),
}
}),
},
};
},
});