feat(User): Add remove getMessages method
We'll use this api to get flash messages on the front end up
This commit is contained in:
@ -775,4 +775,31 @@ module.exports = function(User) {
|
|||||||
return user.challengeMap;
|
return user.challengeMap;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
User.getMessages = function getMessages(messages) {
|
||||||
|
return Promise.resolve(messages);
|
||||||
|
};
|
||||||
|
|
||||||
|
User.remoteMethod('getMessages', {
|
||||||
|
http: {
|
||||||
|
verb: 'get',
|
||||||
|
path: '/get-messages'
|
||||||
|
},
|
||||||
|
accepts: {
|
||||||
|
arg: 'messages',
|
||||||
|
type: 'object',
|
||||||
|
http: ctx => {
|
||||||
|
const messages = ctx.req.flash();
|
||||||
|
console.log('messages: ', messages);
|
||||||
|
return messages;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
returns: [
|
||||||
|
{
|
||||||
|
arg: 'messages',
|
||||||
|
type: 'object',
|
||||||
|
root: true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
@ -365,6 +365,13 @@
|
|||||||
"principalId": "$owner",
|
"principalId": "$owner",
|
||||||
"permission": "ALLOW",
|
"permission": "ALLOW",
|
||||||
"property": "updateLanguage"
|
"property": "updateLanguage"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"accessType": "EXECUTE",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$everyone",
|
||||||
|
"permission": "ALLOW",
|
||||||
|
"property": "getMessages"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"methods": {}
|
"methods": {}
|
||||||
|
Reference in New Issue
Block a user