I am trying to send some data to the server, but I do not know how to return the response data.
I have the following code:
fetch(url, { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({ email: login, password: password, }) }).then(function(a){ console.log(a); })
It prints a Response , it contains data such as body (ReadableByteStream), bodyUsed (false), ok (true), status (200), ... but I can not find the data that I will return anywhere. When I open the Chrome Developer Console, I see the response data there.
What am I doing wrong?
I was looking for some resources like fetch, promises, ... work, but I could not find a well written one.
source share