Advertisement
Guest User

Untitled

a guest
Apr 15th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. constructor(props) {
  2.  
  3. super(props)
  4.  
  5. this.state = {
  6.  
  7. Nik: '',
  8. UserPassword: ''
  9.  
  10. }
  11.  
  12. }
  13. UserLoginFunction = () =>{
  14. const { Nik } = this.state ;
  15. const { UserPassword } = this.state ;
  16.  
  17.  
  18. fetch('url', {
  19. method: 'POST',
  20. headers: {
  21. 'Accept': 'application/json',
  22. 'Content-Type': 'application/json',
  23. },
  24. body: JSON.stringify({
  25.  
  26. user: Nik,
  27.  
  28. pass: UserPassword
  29.  
  30. })
  31.  
  32. }).then((response) => response.json())
  33. .then((responseJson) => {
  34. console.log(responseJson)
  35. })
  36. .catch((error) => {
  37. console.log(error)
  38. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement