Closed KeanuTomatoMomotaro closed 6 years ago
I'm getting a problem after attempting to invoke the rest.post() method to tweet some text.
The code for the method is postTweet(){ var tokens= { consumer_key: 'xxx', consumer_secret: 'xxx', access_token: 'xxx', access_token_secret: 'xxx', }; const {rest} = twitter(tokens); var path = 'statuses/update'; var params = this.state.text; rest.post(path , params) .then(() => {console.log('Posted');}) .catch(console.error); }
postTweet(){ var tokens= { consumer_key: 'xxx', consumer_secret: 'xxx', access_token: 'xxx', access_token_secret: 'xxx', }; const {rest} = twitter(tokens); var path = 'statuses/update'; var params = this.state.text; rest.post(path , params) .then(() => {console.log('Posted');}) .catch(console.error); }
params should be an Object. Try rest.post('statuses/update', {status: this.state.text}). See Twitter docs for more info.
params
Object
rest.post('statuses/update', {status: this.state.text})
I'm getting a problem after attempting to invoke the rest.post() method to tweet some text.
The code for the method is
postTweet(){ var tokens= { consumer_key: 'xxx', consumer_secret: 'xxx', access_token: 'xxx', access_token_secret: 'xxx', }; const {rest} = twitter(tokens); var path = 'statuses/update'; var params = this.state.text; rest.post(path , params) .then(() => {console.log('Posted');}) .catch(console.error); }