diff --git a/webapp/src/Item/Item.tsx b/webapp/src/Item/Item.tsx index 6559b39..f4675c1 100644 --- a/webapp/src/Item/Item.tsx +++ b/webapp/src/Item/Item.tsx @@ -21,9 +21,10 @@ type Props = { } async function addStock(nombre: string): Promise { - const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000/' + //const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000/' + const apiEndPoint = process.env.REACT_APP_API_URI || 'https://dede-es2a-restapi.herokuapp.com/' //let response = - await fetch(apiEndPoint + 'juguete/addStock/' + nombre, { + await fetch(apiEndPoint + '/juguete/addStock/' + nombre, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ "stock": 10 }) diff --git a/webapp/src/PayForm/ProcesoPago.tsx b/webapp/src/PayForm/ProcesoPago.tsx index 79a76cd..da34ec7 100644 --- a/webapp/src/PayForm/ProcesoPago.tsx +++ b/webapp/src/PayForm/ProcesoPago.tsx @@ -44,7 +44,8 @@ async function finalizarPedido(precioGastosDeEnvio: string, juguetes: Juguete[], var price: number; price = calculateTotal(juguetes); const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000/' - let response = await fetch(apiEndPoint + 'pedido', { + //const apiEndPoint = process.env.REACT_APP_API_URI || 'https://dede-es2a-restapi.herokuapp.com/' + let response = await fetch(apiEndPoint + '/pedido', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ @@ -60,6 +61,7 @@ async function finalizarPedido(precioGastosDeEnvio: string, juguetes: Juguete[], // PeticiĆ³n para obtener los gastos de envio async function getGastosEnvio(): Promise { const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000/' + //const apiEndPoint = process.env.REACT_APP_API_URI || 'https://dede-es2a-restapi.herokuapp.com/' let response = await fetch(apiEndPoint + 'pedido/gastosEnvio/', { method: 'POST', headers: { 'Content-Type': 'application/json' }, diff --git a/webapp/src/componentes/Pedidos/historial.tsx b/webapp/src/componentes/Pedidos/historial.tsx index c58451b..a4f7a98 100644 --- a/webapp/src/componentes/Pedidos/historial.tsx +++ b/webapp/src/componentes/Pedidos/historial.tsx @@ -7,9 +7,9 @@ var correo: string; var numero: number; async function getPedidos(): Promise { - const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000/' - //const apiEndPoint= process.env.REACT_APP_API_URI || 'https://dede-en2a-restapi.herokuapp.com' - let response = await fetch(apiEndPoint + "pedido/byUser/" + correo); + //const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000/' + const apiEndPoint = process.env.REACT_APP_API_URI || 'https://dede-es2a-restapi.herokuapp.com/' + let response = await fetch(apiEndPoint + "/pedido/byUser/" + correo); //The objects returned by the api are directly convertible to User objects return response.json(); diff --git a/webapp/src/componentes/editarProducto/editarProducto.tsx b/webapp/src/componentes/editarProducto/editarProducto.tsx index e4381a2..65a6a12 100644 --- a/webapp/src/componentes/editarProducto/editarProducto.tsx +++ b/webapp/src/componentes/editarProducto/editarProducto.tsx @@ -15,7 +15,7 @@ async function getJuguete(): Promise { //const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000/' const apiEndPoint = process.env.API_URL || 'http://localhost:5000/' let partes = url.split('/'); - let response = await fetch(apiEndPoint + "juguete/" + partes[partes.length - 1]); + let response = await fetch(apiEndPoint + "/juguete/" + partes[partes.length - 1]); //The objects returned by the api are directly convertible to User objects let j = response.json(); console.log(j); diff --git a/webapp/src/componentes/nuevoProducto/nuevoProducto.tsx b/webapp/src/componentes/nuevoProducto/nuevoProducto.tsx index 40e8a70..2edefb7 100644 --- a/webapp/src/componentes/nuevoProducto/nuevoProducto.tsx +++ b/webapp/src/componentes/nuevoProducto/nuevoProducto.tsx @@ -11,9 +11,9 @@ var imagen: string; var stock: number; async function addJuguete(): Promise { - const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000/' - //const apiEndPoint= process.env.REACT_APP_API_URI || 'https://dede-en2a-restapi.herokuapp.com' - let response = await fetch(apiEndPoint + "juguete", { + //const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000/' + const apiEndPoint = process.env.REACT_APP_API_URI || 'https://dede-es2a-restapi.herokuapp.com/' + let response = await fetch(apiEndPoint + "/juguete", { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({