mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-23 04:29:21 +00:00
Send refresh conversation request on the server
This commit is contained in:
parent
05c67afe9f
commit
090b8bd77a
@ -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
|
* Empty conversations cache
|
||||||
*
|
*
|
||||||
|
@ -119,6 +119,14 @@ ComunicWeb.components.conversations.service = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Perform a request on the interface
|
//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
|
//Success
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user