fix error message for empty /saved

This commit is contained in:
teddit 2021-02-06 20:27:21 +01:00
parent 5ae520b5ed
commit 4c03933318
2 changed files with 7 additions and 3 deletions

View File

@ -76,8 +76,12 @@ module.exports = (app, redis, fetch, RedditAPI) => {
app.get('/saved', (req, res, next) => {
let saved = req.cookies.saved
if(!saved || !Array.isArray(saved))
return res.send('no saved posts')
if(!saved || !Array.isArray(saved)) {
return res.render('saved', {
json: null,
user_preferences: req.cookies,
})
}
let key = `saved_posts:${saved.join(',')}`
redis.get(key, (error, json) => {

View File

@ -16,7 +16,7 @@ html
h2 saved
#links.sr
if json.links.length === 0
p nothing here
p No saved posts
else
each link in json.links
.link