mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-26 05:49:22 +00:00
Perform request to get friends list
This commit is contained in:
parent
34ce3f9c13
commit
5229349600
@ -26,6 +26,7 @@ ComunicWeb.components.friendsList = {
|
||||
|
||||
//Create and apply friends list element
|
||||
var friendsListContainer = createElem("div");
|
||||
friendsListContainer.id = "friendsList";
|
||||
|
||||
//Check if "pageTarget" already exists or not
|
||||
var pageTarget = byId("pageTarget");
|
||||
@ -52,8 +53,39 @@ ComunicWeb.components.friendsList = {
|
||||
*/
|
||||
init: function(friendsListContainer){
|
||||
|
||||
//First, create the table container
|
||||
var listFriendsElem = createElem("table", friendsListContainer);
|
||||
listFriendsElem.className = "table table-condensed";
|
||||
|
||||
//Refresh friends list
|
||||
this.refresh(listFriendsElem);
|
||||
|
||||
//Success
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Refresh a friend list
|
||||
*
|
||||
* @param {HTMLElement} listFriendsElem The element that contains the list of friens
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
refresh: function(listFriendsElem){
|
||||
//First, perform an API request
|
||||
var apiURI = "friends/getList";
|
||||
var params = {};
|
||||
|
||||
//Perform request
|
||||
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, function(result){
|
||||
|
||||
//Check for error
|
||||
if(result.error){
|
||||
ComunicWeb.debug.logMessage("Couldn't get a new version of friends list !");
|
||||
return false;
|
||||
}
|
||||
|
||||
//Log information
|
||||
ComunicWeb.debug.logMessage("Got a new version of friends list !");
|
||||
});
|
||||
},
|
||||
}
|
Loading…
Reference in New Issue
Block a user