LTroya

Untitled

Feb 15th, 2018
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Component {
  2.  
  3.   follow = () => {
  4.     this.setState({ makingRequest: true });
  5.  
  6.     axios.post(this.state.followUrl, {
  7.         follower: this.state.loginUser.id,
  8.         followee: this.state.user.id,
  9.         _token: this.state.token,
  10.       })
  11.       .then(response => {
  12.         const followees = this.state.followees;
  13.         followees.push(response.data.followee);
  14.  
  15.         this.setState({
  16.           followees: followees,
  17.           makingRequest: false,
  18.         });
  19.       })
  20.       .catch(error => console.log('error', error));
  21.   }
Add Comment
Please, Sign In to add comment