mirror of
https://codeberg.org/SafeTwitch/safetwitch.git
synced 2024-12-22 13:22:58 -05:00
Don't push streams if there are no new ones
This commit is contained in:
parent
957dc4da9a
commit
4222967da7
1 changed files with 10 additions and 3 deletions
|
@ -44,14 +44,21 @@ export default {
|
|||
if (!cursor) return
|
||||
|
||||
// get rest of streams from api
|
||||
const resData = await getEndpoint(
|
||||
const resData: CategoryData = await getEndpoint(
|
||||
`api/discover/${this.$route.params.game}/?cursor=${cursor}`
|
||||
).catch((err) => {
|
||||
throw err
|
||||
})
|
||||
|
||||
for (let stream of resData.streams) {
|
||||
this.data!.streams.push(stream)
|
||||
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) {
|
||||
this.data!.streams.push(stream)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue