Last active
September 19, 2019 02:12
-
-
Save alokm/156ef315e28cbbb82a0c65370a632d3f to your computer and use it in GitHub Desktop.
Valid Solvo input
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// url = 'https://solvo-api.herokuapp.com/api/v1/update' | |
{ | |
"meta": { | |
"name": "System-1", | |
"path": "files/file-1.yml", | |
"ready": false, | |
"error": "" | |
}, | |
"equations": [ | |
{ | |
"text": "x^2 + y^2 = z^2", | |
"disabled": false, | |
"error": "" | |
}, | |
{ | |
"text": "2*x*y=z", | |
"disabled": false, | |
"error": "" | |
}, | |
{ | |
"text": "y/x=1", | |
"disabled": false, | |
"error": "" | |
} | |
], | |
"variable": {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------- | |
function postData(url = '', data = {}) { | |
// Default options are marked with * | |
return fetch(url, { | |
method: 'POST', // *GET, POST, PUT, DELETE, etc. | |
mode: 'no-cors', // no-cors, *cors, same-origin | |
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached | |
credentials: 'same-origin', // include, *same-origin, omit | |
headers: { | |
'Content-Type': 'application/json', | |
// 'Content-Type': 'application/x-www-form-urlencoded', | |
}, | |
redirect: 'follow', // manual, *follow, error | |
referrer: 'no-referrer', // no-referrer, *client | |
body: JSON.stringify(data), // body data type must match "Content-Type" header | |
}) | |
.then(response => response.json()); // parses JSON response into native JavaScript objects | |
} | |
await postData('https://solvo-api.herokuapp.com/api/v1/update ', { equations:[], meta:{}, variable: {} }) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment