Created
July 27, 2020 18:13
-
-
Save tonyspiro/d2760fbde9250977663eed55ba1e90f6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/users', (req, res) => { | |
if(!req.session.user) | |
return res.redirect('/?message=unauthorized') | |
res.locals.user = req.session.user | |
async.series([ | |
callback => { | |
Cosmic.getObjectType({ bucket: { slug: config.COSMIC_BUCKET } }, { type_slug: 'users' }, (err, response) => { | |
res.locals.users = response.objects.all | |
callback() | |
}) | |
}, | |
callback => { | |
Cosmic.getObjects({ bucket: { slug: config.COSMIC_BUCKET } }, (err, response) => { | |
res.locals.cosmic = response | |
return res.render('users.html', { | |
partials | |
}) | |
}) | |
} | |
]) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment