-
-
Save sendbird-community/1fa6f4b6a1fbeced0082d6e5a2f5c125 to your computer and use it in GitHub Desktop.
updateChannelParams function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const updateChannelParams = () => { | |
var channelParams = new sdk.GroupChannelParams(); | |
var messageId = message.messageId; | |
var channelDataString = ""; | |
if (currentChannel.data) { | |
var parsedChannelData = JSON.parse(currentChannel.data); | |
parsedChannelData[`${messageId}`] = { | |
voting_app_options: [], | |
}; | |
channelDataString = JSON.stringify(parsedChannelData); | |
} else { | |
var newChannelData = {}; | |
newChannelData[`${messageId}`] = { | |
voting_app_options: [], | |
}; | |
channelDataString = JSON.stringify(newChannelData); | |
} | |
channelParams.data = channelDataString; | |
currentChannel.updateChannel(channelParams, (err, channel) => { | |
var parsedChannelData = JSON.parse(channelParams.data); | |
console.log("updatedChannelParamsData new=", parsedChannelData); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment