Skip to content

Commit

Permalink
Adaptar direcciones
Browse files Browse the repository at this point in the history
  • Loading branch information
UO271728 committed May 3, 2022
1 parent dbfae67 commit 4c46993
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
5 changes: 3 additions & 2 deletions webapp/src/Item/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ type Props = {
}

async function addStock(nombre: string): Promise<any> {
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 })
Expand Down
4 changes: 3 additions & 1 deletion webapp/src/PayForm/ProcesoPago.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -60,6 +61,7 @@ async function finalizarPedido(precioGastosDeEnvio: string, juguetes: Juguete[],
// Petición para obtener los gastos de envio
async function getGastosEnvio(): Promise<any> {
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' },
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/componentes/Pedidos/historial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ var correo: string;
var numero: number;

async function getPedidos(): Promise<Pedido[]> {
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();

Expand Down
2 changes: 1 addition & 1 deletion webapp/src/componentes/editarProducto/editarProducto.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function getJuguete(): Promise<Juguete> {
//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);
Expand Down
6 changes: 3 additions & 3 deletions webapp/src/componentes/nuevoProducto/nuevoProducto.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ var imagen: string;
var stock: number;

async function addJuguete(): Promise<any> {
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({
Expand Down

0 comments on commit 4c46993

Please sign in to comment.