diff --git a/routes.js b/routes.js index 4eec4b2..8f87f39 100644 --- a/routes.js +++ b/routes.js @@ -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) => { diff --git a/views/saved.pug b/views/saved.pug index de7c0b0..ac30e6c 100644 --- a/views/saved.pug +++ b/views/saved.pug @@ -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