Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. const reqBody = { bio: this.state.infoContent };
  2.  
  3. const cfg = { headers: { 'Accept': 'application/json','Content-Type': 'application/json', 'Authorization': this.store.user.token } };
  4. axios.post(endpoint.users+'/profilesetdata', reqBody, cfg)
  5. .then((result) => {
  6. //...
  7. })
  8. .catch((err) => {
  9. //...
  10. })
  11.  
  12. // the condition is the difference
  13. if ( type == 'bio' ){
  14. const reqBody = { bio: this.state.infoContent };
  15. }else{
  16. const reqBody = { bio: this.state.infoContent };
  17. }
  18.  
  19. const cfg = { headers: { 'Accept': 'application/json','Content-Type': 'application/json', 'Authorization': this.store.user.token } };
  20. axios.post(endpoint.users+'/profilesetdata', reqBody, cfg)
  21. .then((result) => {
  22. //...
  23. })
  24. .catch((err) => {
  25. //...
  26. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement