-
-
Save parzibyte/68099286449c9de3ddbea8de112ceb96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async manejarEnvioDeFormulario(evento) { | |
evento.preventDefault(); | |
// Codificar nuestro videojuego como JSON | |
const cargaUtil = JSON.stringify(this.state.videojuego); | |
// ¡Y enviarlo! | |
const respuesta = await fetch(`${Constantes.RUTA_API}/actualizar_videojuego.php`, { | |
method: "PUT", | |
body: cargaUtil, | |
}); | |
const exitoso = await respuesta.json(); | |
if (exitoso) { | |
toast('Videojuego guardado 🎮', { | |
position: "top-left", | |
autoClose: 2000, | |
hideProgressBar: false, | |
closeOnClick: true, | |
pauseOnHover: true, | |
draggable: true, | |
progress: undefined, | |
}); | |
} else { | |
toast.error("Error guardando. Intenta de nuevo"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment