diff --git a/restapi/server.ts b/restapi/server.ts index 7954035..274db5f 100644 --- a/restapi/server.ts +++ b/restapi/server.ts @@ -19,7 +19,7 @@ let bd = require('./utils/connectDB') const metricsMiddleware:RequestHandler = promBundle({includeMethod: true}); app.use(metricsMiddleware); -app.use(cors(options)); +app.use(cors()); app.use(bp.json()); app.use(express.json()); diff --git a/webapp/src/api/api.ts b/webapp/src/api/api.ts index fb94dc4..fc9d668 100644 --- a/webapp/src/api/api.ts +++ b/webapp/src/api/api.ts @@ -3,25 +3,6 @@ import {Product, Pedido, PaymentType} from '../shared/shareddtypes'; import {ShipmentData, User} from '../shared/shareddtypes'; import { CartProduct } from '../shared/shareddtypes'; -export async function addUser(user:User):Promise{ - const apiEndPoint= process.env.REACT_APP_API_URI || 'http://localhost:5000/api' - let response = await fetch(apiEndPoint+'/users/add', { - method: 'POST', - headers: {'Content-Type':'application/json'}, - body: JSON.stringify({'name':user.name, 'email':user.email}) - }); - if (response.status===200) - return true; - else - return false; -} - -export async function getUsers():Promise{ - const apiEndPoint= process.env.REACT_APP_API_URI || 'http://localhost:5000/api' - let response = await fetch(apiEndPoint+'/users/list'); - //The objects returned by the api are directly convertible to User objects - return response.json() -} export async function addOrder(cartProducts:Product[], price:number, url:string, user_id:string|undefined){ const apiEndPoint= process.env.REACT_APP_API_URI || 'http://localhost:5000' @@ -63,7 +44,7 @@ export async function getProductByCode(code: string): Promise{ } export async function createOrder(DataOrder:ShipmentData):Promise{ - const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000/api'; + const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000'; let response = await fetch(apiEndPoint+'/createOrder',{ method: 'POST', headers: {'Content-Type':'application/json'}, @@ -79,7 +60,7 @@ export async function createOrder(DataOrder:ShipmentData):Promise{ export async function createTransaction(rate:string):Promise{ debugger; - const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000/api'; + const apiEndPoint = process.env.REACT_APP_API_URI || 'http://localhost:5000'; let response = await fetch(apiEndPoint+'/createTransaction',{ method: 'POST', headers: {'Content-Type':'application/json'},