我正在運行express-stormpath auth的快速服務器並存儲有關用戶的相同自定義數據。Stormpath Express:保存自定義數據
如何發佈數據到服務器並將它們保存爲stormpath? 目前我的帖子是這樣的:
app.post('/post', stormpath.loginRequired, function(req, res) {
var stundenplan_data = req.body;
console.log(stundenplan_data);
req.user.customData.stundenplan = stundenplan_data;
req.user.customData.save();
});
我得到我想要的的console.log後,但如果我叫在另一個get請求的數據自定義數據是空的正確的數據。
你可以傳遞一個回調來保存()函數,看它是否返回任何錯誤? – robertjd 2014-11-14 22:21:46
沒有IAM沒有得到unsing當任何錯誤:res.locals.user.save(函數(ERR,updatedUser){ \t \t如果(ERR){ \t \t updatedUser.customData.anotherfield; \t \t的console.log(! 「error」); // undefined \t \t} \t}); – brighthero 2014-11-15 10:18:33