Guest User

Untitled

a guest
Jan 8th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. fetch("http://localhost:8001/api/login", {
  2. method: 'post',
  3. headers: {
  4. "Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
  5. },
  6. body: 'username=' + this.state.username + '&password=' + this.state.password
  7. })
  8. .then(function (responseObject) {
  9. console.log('Request succeeded with Response object', responseObject);
  10.  
  11. })
  12. .then(function (result){
  13. console.log(result);
  14. })
  15. .catch(function (error) {
  16. console.log('Request failed', error);
  17. });
  18. }else{
  19. console.log('You must enter username, password.');
  20. }
Add Comment
Please, Sign In to add comment