Просмотр исходного кода

send populated current user data to /me

yusuketk 5 лет назад
Родитель
Сommit
149cc0cdc1
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      src/server/routes/me.js

+ 6 - 2
src/server/routes/me.js

@@ -100,8 +100,12 @@ module.exports = function(crowi, app) {
       });
   };
 
-  actions.index = function(req, res) {
-    return res.render('me/index');
+  actions.index = async function(req, res) {
+    const User = crowi.model('User');
+    const userData = await User.findById(req.user.id).populate({ path: 'imageAttachment', select: 'filePathProxied' });
+    const renderVars = {};
+    renderVars.user = userData;
+    return res.render('me/index', renderVars);
   };
 
   actions.externalAccounts = {};