Don't push streams if there are no new ones
This commit is contained in:
parent
957dc4da9a
commit
4222967da7
@ -44,17 +44,24 @@ export default {
|
|||||||
if (!cursor) return
|
if (!cursor) return
|
||||||
|
|
||||||
// get rest of streams from api
|
// get rest of streams from api
|
||||||
const resData = await getEndpoint(
|
const resData: CategoryData = await getEndpoint(
|
||||||
`api/discover/${this.$route.params.game}/?cursor=${cursor}`
|
`api/discover/${this.$route.params.game}/?cursor=${cursor}`
|
||||||
).catch((err) => {
|
).catch((err) => {
|
||||||
throw err
|
throw err
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let lastStreamCursor = this.data!.streams[this.data!.streams.length-1].cursor
|
||||||
|
let newLastStreamCursor = resData.streams[resData.streams.length-1].cursor
|
||||||
|
if (lastStreamCursor === newLastStreamCursor) {
|
||||||
|
// Add "no more streams!" screen later
|
||||||
|
console.log("no more streams!")
|
||||||
|
} else {
|
||||||
for (let stream of resData.streams) {
|
for (let stream of resData.streams) {
|
||||||
this.data!.streams.push(stream)
|
this.data!.streams.push(stream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
abbreviate
|
abbreviate
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user