fix error message for empty /saved
This commit is contained in:
parent
5ae520b5ed
commit
4c03933318
|
@ -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) => {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue