Estoy obteniendo datos de una API y colocándolos en una tabla para reaccionar hasta ahora, pero cuando trato de editar los datos de una fila en la tabla. Esto me da el error "PUT 400 (Solicitud incorrecta)". ¿Cómo debo cambiar FormData() para recibir el valor de "<Form.Control/>" y luego recibirlo del backend?
---Editar2.js---
handlerSubmit = async (event) => { event.preventDefault(); let formData = new FormData(); formData.set("", event.target.legenda.value); let resposta = await fetch("api/FotografiasAPI/" + this.props.idLinha, { method: "PUT", headers:{'Accept':'application/json','Content-Type':'application/json'}, body: formData }); if (!resposta.ok) { console.error("error:" + resposta.status); } return await resposta.json(); } render(){ return( <Modal {...this.props}> <Form onSubmit={this.handlerSubmit}> <Form.Group controlId="legenda"> <Form.Label>legenda</Form.Label> <Form.Control defaultValue = {this.props.legenda} type="text"name="legenda" required placeholder="legenda"/> </Form.Group> <Form.Group> <Button variant="primary" type="submit"> Editar Restaurante </Button> </Form.Group> </Form> </Modal> );}}---Backend---
[HttpPut("{id}")] public async Task<IActionResult> PutFotografias(int id, [FromForm] Fotografias fotografias) { if (id != fotografias.ID) {return BadRequest();} _context.Entry(fotografias).State = EntityState.Modified; try {await _context.SaveChangesAsync();} catch (DbUpdateConcurrencyException) { if (!FotografiasExists(id)) {return NotFound();} else {throw;}} return NoContent(); }