poter visualizzare i propri beni e servizi anche se non sei registrato alla app !

This commit is contained in:
Surya Paolo
2023-01-04 02:09:42 +01:00
parent 18b827f5f4
commit dd1c9d573f
5 changed files with 30 additions and 6 deletions

View File

@@ -395,8 +395,9 @@ router.patch('/:id', authenticate, (req, res) => {
});
});
router.post('/profile', authenticate, (req, res) => {
const usernameOrig = req.user.username;
router.post('/profile', (req, res) => {
const usernameOrig = req.user ? req.user.username : '';
const perm = req.user ? req.user.perm : tools.Perm.PERM_NONE;
const username = req.body['username'];
const idapp = req.body.idapp;
const locale = req.body.locale;
@@ -409,11 +410,11 @@ router.post('/profile', authenticate, (req, res) => {
const idnotif = req.body['idnotif'] ? req.body['idnotif'] : '';
SendNotif.setNotifAsRead(idapp, usernameOrig, idnotif);
return User.getUserProfileByUsername(idapp, username, req.user.username,
false, req.user.perm).
return User.getUserProfileByUsername(idapp, username, usernameOrig,
false, perm).
then((ris) => {
return User.getFriendsByUsername(idapp, req.user.username).
return User.getFriendsByUsername(idapp, usernameOrig).
then((friends) => {
res.send({ user: ris, friends });
});