mirror of
https://codeberg.org/tacerus/teddit.git
synced 2024-11-29 19:29:27 +01:00
check that morechildren data has .things
This commit is contained in:
parent
1d79e23b70
commit
9531e5527d
@ -730,6 +730,8 @@ module.exports = (app, redis, fetch, RedditAPI) => {
|
|||||||
if(result.status === 200) {
|
if(result.status === 200) {
|
||||||
result.json()
|
result.json()
|
||||||
.then(json => {
|
.then(json => {
|
||||||
|
if(json.json.data) {
|
||||||
|
if(json.json.data.things) {
|
||||||
let comments = json.json.data.things
|
let comments = json.json.data.things
|
||||||
redis.setex(key, config.setexs.posts, JSON.stringify(comments), (error) => {
|
redis.setex(key, config.setexs.posts, JSON.stringify(comments), (error) => {
|
||||||
if(error) {
|
if(error) {
|
||||||
@ -742,6 +744,12 @@ module.exports = (app, redis, fetch, RedditAPI) => {
|
|||||||
return res.redirect(`${post_url}?cursor=${page}&page=${page}`)
|
return res.redirect(`${post_url}?cursor=${page}&page=${page}`)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
return res.redirect(post_url)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return res.redirect(post_url)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
console.error(`Something went wrong while fetching data from reddit API. ${result.status} – ${result.statusText}`)
|
console.error(`Something went wrong while fetching data from reddit API. ${result.status} – ${result.statusText}`)
|
||||||
|
Loading…
Reference in New Issue
Block a user