diff --git a/src/mixins.ts b/src/mixins.ts index 6991ce3..1837bb6 100644 --- a/src/mixins.ts +++ b/src/mixins.ts @@ -137,7 +137,9 @@ export async function getParsedFollowing( let res: FollowingStreamer[] = [] - const payloadData = streamers.slice(cursor, cursor + 35) + const start = cursor * 35 + const end = (cursor + 1) * 35 + const payloadData = streamers.slice(start, end) const payload = { streamers: payloadData diff --git a/src/views/FollowingView.vue b/src/views/FollowingView.vue index 6db3524..bdca463 100644 --- a/src/views/FollowingView.vue +++ b/src/views/FollowingView.vue @@ -39,12 +39,14 @@ export default { return } - const cursor = this.data.length / 35 - const maxCursor = follows.length / 35 + const cursor = Math.ceil(this.data.length / 35) + const maxCursor = Math.floor(follows.length / 35) + if (cursor > maxCursor) return const chunk = await getParsedFollowing(follows, cursor) this.data = [...this.data, ...chunk] + console.log(this.data[this.data.length - 1]) } }, async mounted() { @@ -64,10 +66,7 @@ export default {