data fetching post request code example
Example 1: how to post data using fethch
fetch('url here', {
method: 'POST',
headers: {'Content-Type':'application/x-www-form-urlencoded'}, // this line is important, if this content-type is not set it wont work
body: 'foo=bar&blah=1'
});
Example 2: fetch and post dummy data api
For get request: https://jsonplaceholder.typicode.com/
For post request: https://reqbin.com/req/zvtstmpb/post-request-example