Last active
August 20, 2020 21:04
-
-
Save isaidspaghetti/828c1aabb6e6365480e98b8d70721bc2 to your computer and use it in GitHub Desktop.
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
try { | |
//...first half of function | |
const { customerId, customerToken, channelId, streamApiKey } = await response.json(); | |
chatClient = new StreamChat(streamApiKey); | |
await chatClient.setUser( | |
{ | |
id: customerId, | |
name: firstName, | |
}, | |
customerToken, | |
); | |
const channel = chatClient.channel('messaging', channelId, { | |
name: `Chat with ${customerId}` | |
}); | |
await channel.watch; | |
setChannel(channel); | |
} catch (e) { | |
console.error(e, e.error); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment