Merge pull request #37 from njuclc/master
fix: query multiple posts from a user
This commit is contained in:
commit
27b900e7be
@ -158,9 +158,9 @@ const parsePosts = async (
|
|||||||
let hasMore = true
|
let hasMore = true
|
||||||
let cursor: number | null = null
|
let cursor: number | null = null
|
||||||
const posts: Posts[] = []
|
const posts: Posts[] = []
|
||||||
|
let counter = 0
|
||||||
while (hasMore) {
|
while (hasMore) {
|
||||||
let result: any | null = null
|
let result: any | null = null
|
||||||
let counter = 0
|
|
||||||
|
|
||||||
// Prevent missing response posts
|
// Prevent missing response posts
|
||||||
for (let i = 0; i < 30; i++) {
|
for (let i = 0; i < 30; i++) {
|
||||||
@ -246,8 +246,10 @@ const parsePosts = async (
|
|||||||
// Restrict too many data requests
|
// Restrict too many data requests
|
||||||
if (postLimit !== 0) {
|
if (postLimit !== 0) {
|
||||||
let loopCount = Math.floor(postLimit / 30)
|
let loopCount = Math.floor(postLimit / 30)
|
||||||
if (counter >= loopCount) hasMore = false
|
if (counter >= loopCount) {
|
||||||
break
|
hasMore = false
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hasMore = result.hasMore
|
hasMore = result.hasMore
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user