mirror of
https://codeberg.org/tacerus/teddit.git
synced 2025-01-09 21:02:36 +01:00
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) => {
|
app.get('/saved', (req, res, next) => {
|
||||||
let saved = req.cookies.saved
|
let saved = req.cookies.saved
|
||||||
|
|
||||||
if(!saved || !Array.isArray(saved))
|
if(!saved || !Array.isArray(saved)) {
|
||||||
return res.send('no saved posts')
|
return res.render('saved', {
|
||||||
|
json: null,
|
||||||
|
user_preferences: req.cookies,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
let key = `saved_posts:${saved.join(',')}`
|
let key = `saved_posts:${saved.join(',')}`
|
||||||
redis.get(key, (error, json) => {
|
redis.get(key, (error, json) => {
|
||||||
|
@ -16,7 +16,7 @@ html
|
|||||||
h2 saved
|
h2 saved
|
||||||
#links.sr
|
#links.sr
|
||||||
if json.links.length === 0
|
if json.links.length === 0
|
||||||
p nothing here
|
p No saved posts
|
||||||
else
|
else
|
||||||
each link in json.links
|
each link in json.links
|
||||||
.link
|
.link
|
||||||
|
Loading…
Reference in New Issue
Block a user