diff --git a/backend/src/app.ts b/backend/src/app.ts index 1e06e19b..1709e7d4 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -24,7 +24,7 @@ import * as apiController from "./controllers/api"; const app = express(); // Enable all CORS requests -app.use(cors({credentials: true, origin: true})); +app.use(cors()); app.options("*", cors()); // Log requests diff --git a/frontend/src/pages/Login.tsx b/frontend/src/pages/Login.tsx index 73f6bf1d..618078f8 100644 --- a/frontend/src/pages/Login.tsx +++ b/frontend/src/pages/Login.tsx @@ -15,6 +15,7 @@ import { Link, RouteComponentProps } from 'react-router-dom' import { AppContext, ActionTypes } from '../context/appContext' import { InputChangeEventDetail } from "@ionic/core"; import wretcher from '../wretcher'; +import wretch from "wretch"; // Images import logo from '../assets/img/logo.png'; @@ -34,8 +35,8 @@ const Login: React.SFC = (props) => { } try { // TODO: get authorization token - await wretcher - .url('/api/login') + await wretch('https://storestash.herokuapp.com/api/login') + .options({ credentials: "include", mode: "cors" }) .post({ email, password }) .json(data => { console.log(data);