mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Send refresh conversation request on the server
This commit is contained in:
parent
05c67afe9f
commit
090b8bd77a
@ -105,7 +105,7 @@ ComunicWeb.common.network = {
|
||||
networkErrorMessage.id = "networkErrorMessage";
|
||||
|
||||
//Create a callout element within it
|
||||
var errorName = "<i class='fa fa-warning'></i> "+"Network error";
|
||||
var errorName = "<i class='fa fa-warning'></i> "+" Network error";
|
||||
var errorMessage = "It seems that there is a network error, and Comunic can't access to the Internet anymore... Please check your internet connexion...";
|
||||
var errorCallout = ComunicWeb.common.messages.createCalloutElem(errorName, errorMessage, "danger");
|
||||
networkErrorMessage.appendChild(errorCallout)
|
||||
|
@ -264,6 +264,34 @@ ComunicWeb.components.conversations.interface = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Refresh a conversation
|
||||
*
|
||||
* @param {Array} newConversations New conversations (which requires the 10 last messages)
|
||||
* @param {Object} toRefresh Conversations to refresh
|
||||
* @param {Function} callback The callback function
|
||||
* @return {Boolean} True for a success
|
||||
*/
|
||||
refreshConversations: function(newConversations, toRefresh, callback){
|
||||
|
||||
//DEBUG log informations
|
||||
console.log("New conversations", newConversations);
|
||||
console.log("To refresh", toRefresh);
|
||||
|
||||
//Perform a request on the API
|
||||
var apiURI = "conversations/refresh";
|
||||
var params = {
|
||||
newConversations: newConversations,
|
||||
toRefresh: JSON.stringify(toRefresh),
|
||||
}
|
||||
|
||||
//Perform an API request
|
||||
ComunicWeb.common.api.makeAPIrequest(apiURI, params, true, callback);
|
||||
|
||||
//Success
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Empty conversations cache
|
||||
*
|
||||
|
@ -119,7 +119,15 @@ ComunicWeb.components.conversations.service = {
|
||||
}
|
||||
|
||||
//Perform a request on the interface
|
||||
|
||||
ComunicWeb.components.conversations.interface.refreshConversations(
|
||||
newConversations,
|
||||
conversationsToRefresh,
|
||||
function(result){
|
||||
//Call callback function
|
||||
ComunicWeb.components.conversations.service.callback(result);
|
||||
}
|
||||
);
|
||||
|
||||
//Success
|
||||
return true;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user