Skip to content

Commit

Permalink
Try #3 fixing CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
ML-Chen committed Apr 30, 2020
1 parent 21140e3 commit 91cebff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/pages/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -34,8 +35,8 @@ const Login: React.SFC<RouteComponentProps> = (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);
Expand Down

0 comments on commit 91cebff

Please sign in to comment.