I simply want to send a value to my rest api in a fetch method but can't seem to get it to work. This is what I have currently:
React:
getFloorplans() {
fetch('/api/ssid')
.then(response => response.json())
.then(message => {
this.setState({
floorplan: message[0]
})
});
fetch('/api/ssid', {
method: "POST",
//make sure to serialize your JSON body
value: {ssid: this.state.SSID}
})
.then( (response => response.json()
.then(message => {
console.log(message);
})
))};
Spring boot rest api:
@RestController
public class FloorplanController {
//Floorplan floorplan = new Floorplan();
@RequestMapping("/api/ssid")
public void someMethod(@RequestParam String value) {
System.out.println(value);
}
}