constructor(){
super();
this.state = {
assets: []
}
}
componentDidMount() {
fetch('3.xxx.xx.xxx:8080/assets', {
method: 'post',
headers: "Content-Type: application/x-www-form-urlencoded",
body: "key=ecmdecmedmjrjekrkl"
})
.then(assets => this.setState({assets}, () => console.log('Fetched!')))
}
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!')));