Guest User

Untitled

a guest
May 19th, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. TypeError: Network request failed
  2. at XMLHttpRequest.xhr.onerror (blob:http://localhost:8081/9b6428f5-4e65-45a0-9490-3852c365f0df:15823:18)
  3. at XMLHttpRequest.dispatchEvent (blob:http://localhost:8081/9b6428f5-4e65-45a0-9490-3852c365f0df:17900:39)
  4. at XMLHttpRequest.setReadyState (blob:http://localhost:8081/9b6428f5-4e65-45a0-9490-3852c365f0df:17655:20)
  5. at XMLHttpRequest.__didCompleteResponse (blob:http://localhost:8081/9b6428f5-4e65-45a0-9490-3852c365f0df:17482:16)
  6. at blob:http://localhost:8081/9b6428f5-4e65-45a0-9490-3852c365f0df:17592:47
  7. at RCTDeviceEventEmitter.emit (blob:http://localhost:8081/9b6428f5-4e65-45a0-9490-3852c365f0df:3478:37)
  8. at MessageQueue.__callFunction (blob:http://localhost:8081/9b6428f5-4e65-45a0-9490-3852c365f0df:2384:44)
  9. at blob:http://localhost:8081/9b6428f5-4e65-45a0-9490-3852c365f0df:2154:17
  10. at MessageQueue.__guardSafe (blob:http://localhost:8081/9b6428f5-4e65-45a0-9490-3852c365f0df:2346:11)
  11. at MessageQueue.callFunctionReturnFlushedQueue (blob:http://localhost:8081/9b6428f5-4e65-45a0-9490-3852c365f0df:2153:14) {stack: TypeError: Network request failed
  12. at XMLHttpRe…081/9b6428f5-4e65-45a0-9490-3852c365f0df:2153:14),
  13. message: Network request failed}
  14.  
  15. const apiURL = "192.168.1.5:3000/api/";
  16.  
  17.  
  18. fetch(apiURL + '/login', {
  19. method: 'POST',
  20. headers: {
  21. 'Content-Type': 'application/json'
  22. },
  23. body: JSON.stringify({
  24. username: this.props.username,
  25.  
  26. password: this.props.password
  27. })
  28. })
  29. .then((response) => response.json())
  30. .then((responseJson) => {
  31. console.log(responseJson);
  32. })
  33. .catch((error) => {
  34. console.log(error);
  35. });
Add Comment
Please, Sign In to add comment