Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fetchGroups() {
var limit = 30;
var groupsRequest = new CometChat.GroupsRequestBuilder().setLimit(limit).build();
groupsRequest.fetchNext().then(
groupList => {
console.log("Groups list fetched successfully", groupList);
if(groupList.length >0){
CometChat.getUnreadMessageCountForAllGroups().then(array=>{
var unread = Object.keys(array);
if(unread.length > 0){
unread.map(guid =>{
var index = groupList.findIndex(group=> group.guid == guid);
if(index != -1){
groupList[index].unreadCount = array[guid];
}
});
}
this.setState({