From 589b96d8bb6c7df2d7005f791534f4ce7446ab15 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Wed, 1 Apr 2020 19:05:31 +0200 Subject: [PATCH] Can easily get information about a single user --- assets/js/common/shorcuts.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/assets/js/common/shorcuts.js b/assets/js/common/shorcuts.js index ad1b0539..8d64e181 100644 --- a/assets/js/common/shorcuts.js +++ b/assets/js/common/shorcuts.js @@ -181,6 +181,22 @@ function getUserInfo(usersID, afterGetUserInfo, forceRequest){ ComunicWeb.user.userInfos.getUserInfos(usersID, afterGetUserInfo, forceRequest); } +/** + * Get information about a single user asynchronously + * + * @param {Number} userID Target user ID + */ +function userInfo(userID) { + return new Promise((res, err) => { + getUserInfo(userID, (data) => { + if(data.error) + err(data.error) + else + res(data) + }, false); + }); +} + /** * Display message on browser console *