How to perform a POST request with the parameters of the Badi and Hader?

Please help to perform post request to retrieve json

 this.state = {
 assets: []

componentDidMount() {
 fetch('', {
 method: 'post',
 headers: "Content-Type: application/x-www-form-urlencoded",
 body: "key=ecmdecmedmjrjekrkl"
 .then(assets => this.setState({assets}, () => console.log('Fetched!')))

Unhandled Rejection (TypeError): Failed to execute 'fetch' on 'Window': The provided value is not of type
March 19th 20 at 08:34
1 answer
March 19th 20 at 08:36
const form = new FormData();
form.append('key', 'ecmdecmedmjrjekrkl');

fetch('/some-path', {
 method: 'POST',
 headers: "Content-Type: application/x-www-form-urlencoded",
 body: form,
}).then(assets => this.setState({assets}, () => console.log('Fetched!')));

Good, your app needs to communicate with the server via the REST API, the data is transferred in JSON format.

Sehardcore access key is not the best solution.

Find more questions by tags ReactAPI