title: making POST request using fetch
body: <p>If not using vanilla js I have always used jQuery to make <code>AJAX</code> requests. Now since React has been taking over, to make <code>AJAX</code> requests there is no need to use the whole <code>jQuery</code> library to make these requests so we are encouraged to use either js' built in <code>fetch</code> method, axios or many others.</p>
  
  <p>I have been trying to make a <code>POST</code> request using <code>fetch</code>. I am able to make it using <code>axis</code> but not fetch. </p>
  
  <pre><code>axios.post('https://reqres.in/api/login', {
      "email": "peter@klaven",
      "password": "cityslicka"
  })
  .then(function (response) {
      console.log(response);
  })
  .catch(function (error) {
      console.log(error);
  }); 
  </code></pre>
  
  <p>The axios code looks like this, but when I try what I believe to be the same thing using <code>fetch</code> it doesn't work. Can anyone see what I am missing? The values are being posted, but the API is returning an error, so I must be doing something wrong.</p>
  
  <pre><code>var data = {
      "email": "peter@klaven",
      "password": "cityslicka"
  }
  
  fetch("https://reqres.in/api/login", {
      method: "POST",
      body:  JSON.stringify(data)
  })
  .then(function(response){ 
      return response.json(); 
  })
  .then(function(data){ 
      console.log(data)
  });
  </code></pre>