1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-22 09:51:29 +00:00

Converting raw mongoose objects to json

This commit is contained in:
Scott Tolksdorf
2016-08-09 13:32:46 -04:00
parent 34b21703e1
commit 91c7f45d33

View File

@@ -62,7 +62,7 @@ app.get('/edit/:id', function(req, res){
var resObj = null; var resObj = null;
var errObj = {text: "# oops\nCould not find the homebrew."} var errObj = {text: "# oops\nCould not find the homebrew."}
if(objs.length){ if(objs.length){
resObj = objs[0]; resObj = objs[0].toJSON();
} }
vitreumRender({ vitreumRender({
@@ -102,7 +102,7 @@ app.get('/share/:id', function(req, res){
prerenderWith : './client/homebrew/homebrew.jsx', prerenderWith : './client/homebrew/homebrew.jsx',
initialProps: { initialProps: {
url: req.originalUrl, url: req.originalUrl,
brew : sanitizeBrew(resObj || errObj) brew : sanitizeBrew(resObj.toJSON() || errObj)
}, },
clearRequireCache : !process.env.PRODUCTION, clearRequireCache : !process.env.PRODUCTION,
}, function (err, page) { }, function (err, page) {