我正在尝试和 sendbird 一起玩。我收到此错误。我正在尝试使 sendbird api 在 react.js 应用程序中工作。我已经阅读了文档,但我并不清楚。我查看了 stackoverflow 早期的回复,这就是为什么,我在连接到 sendbird 后尝试创建频道。
VM2257:1 POST https://api.sendbird.com/v3/group_channels 400 (BAD
REQUEST)
error is here p {name: "SendBirdException", code: 400201, message: "User not found."}
我正在尝试在 react.js 中实现它。这是我的代码。有人可以帮我解决这个错误。
import React, { Component } from 'react';
import * as SendBird from 'sendbird';
import './App.css';
var sb = new SendBird({'appId': '59BEEA34-BDC7-461B-B10B-63705C8B57C2'});
class App extends Component {
componentWillMount(){
sb.connect("ankur1", function(user, error) {
if(user){
console.log("looks like connected",user)
var userIds = ['unique_user_id1', 'unique_user_id2','ankur1'];
var name = "amazing1";
sb.GroupChannel.createChannelWithUserIds(userIds, false, name, function(createdChannel, error) {
if (error) {
console.error("error is here",error);
return;
}
console.log("success",createdChannel);
});
}
else{
console.log("looks like error")
}
})
}
sm(){
console.log("button clicked",sb)
var channel = "amazing"
/*
sb.channel.sendUserMessage("that is cool", '', function(message, error){
if (error) {
console.error(error);
return;
}
console.log(message);
});
*/
}
componentDidMount(){
}
render() {
var sm = this.sm.bind(this)
return (
<div>
<h1>ankur is here </h1>
<button onClick={sm}>click here</button>
</div>
);
}
}
export default App;