Fetch uses body, not data.

This commit is contained in:
mmcwilliams 2017-11-22 11:34:51 -05:00
parent fdc0f41725
commit fe492eca6f
1 changed files with 1 additions and 2 deletions

View File

@ -558,11 +558,10 @@
const counter = document.getElementById('counter').value; const counter = document.getElementById('counter').value;
const change = prompt(`Change counter value?`, counter); const change = prompt(`Change counter value?`, counter);
if (change === null || !isNumeric(change)) return false; if (change === null || !isNumeric(change)) return false;
console.log(change);
const opts = { const opts = {
method : 'POST', method : 'POST',
headers : web._header, headers : web._header,
data : JSON.stringify({ counter : change }) body : JSON.stringify({ counter : change })
} }
fetch('/counter', opts) fetch('/counter', opts)
.then(web.useJson) .then(web.useJson)