From 8de496826a700ef5aa2e3c81917b3d5e289b2f03 Mon Sep 17 00:00:00 2001 From: Clayton Wilson Date: Wed, 2 Oct 2019 22:53:31 -0400 Subject: [PATCH] Testing login backend --- functions/util/fbAuth.js | 7 +++++++ twistter-frontend/package.json | 2 +- twistter-frontend/src/pages/edit.js | 2 ++ .../src/redux/actions/userActions.js | 20 +++++++++---------- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/functions/util/fbAuth.js b/functions/util/fbAuth.js index a9243cc..3b59d14 100644 --- a/functions/util/fbAuth.js +++ b/functions/util/fbAuth.js @@ -4,6 +4,13 @@ const { admin, db } = require('./admin'); // The function will only execute if the user is logged in, or rather, they have // a valid token module.exports = (req, res, next) => { + console.log(req); + console.log(req.body); + console.log(req.headers); + console.log(req.headers.authorization); + console.log(JSON.stringify(req.body)); + console.log(JSON.stringify(req.header)); + let idToken; // Checking that the token exists in the header of the request diff --git a/twistter-frontend/package.json b/twistter-frontend/package.json index a83c175..eebb8fb 100644 --- a/twistter-frontend/package.json +++ b/twistter-frontend/package.json @@ -37,5 +37,5 @@ "last 1 safari version" ] }, - "proxy": "https://us-central1-twistter-e4649.cloudfunctions.net/api" + "proxy": " http://localhost:5001/twistter-e4649/us-central1/api" } diff --git a/twistter-frontend/src/pages/edit.js b/twistter-frontend/src/pages/edit.js index 306e19b..14d5172 100644 --- a/twistter-frontend/src/pages/edit.js +++ b/twistter-frontend/src/pages/edit.js @@ -85,6 +85,7 @@ export class edit extends Component { axios .post("/updateProfileInfo", newProfileData) .then((res) => { + console.log(res); this.setState({ loading: false }); @@ -92,6 +93,7 @@ export class edit extends Component { // TODO: Need to redirect user to their profile page }) .catch((err) => { + console.log(err); this.setState({ errors: err.response.data, loading: false diff --git a/twistter-frontend/src/redux/actions/userActions.js b/twistter-frontend/src/redux/actions/userActions.js index e7e5535..2d87738 100644 --- a/twistter-frontend/src/redux/actions/userActions.js +++ b/twistter-frontend/src/redux/actions/userActions.js @@ -23,13 +23,13 @@ export const loginUser = (loginData, history) => (dispatch) => { }); } -export const getProfileInfo = () => (dispatch) => { - axios.get('/getProfileInfo') - .then((res) => { - dispatch({ - type: SET_USER, - payload: res.data, - }) - }) - .catch((err) => console.error(err)); -} \ No newline at end of file +// export const getProfileInfo = () => (dispatch) => { +// axios.get('/getProfileInfo') +// .then((res) => { +// dispatch({ +// type: SET_USER, +// payload: res.data, +// }) +// }) +// .catch((err) => console.error(err)); +// } \ No newline at end of file