From 45243c7e26eb2579e623d520c9dd093b8a5957a9 Mon Sep 17 00:00:00 2001 From: Asara Date: Mon, 16 Sep 2019 21:04:31 -0400 Subject: [PATCH] YAY JWTS! ty mark --- src/actions/index.js | 1 - src/components/NavBar.js | 3 +-- src/reducers/authReducer.js | 5 ++++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/actions/index.js b/src/actions/index.js index 3f41943..d894f68 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -24,5 +24,4 @@ export const userLogin = (username, password) => async (dispatch) => { password: password }) dispatch({ type: 'USER_LOGIN', payload: response }) - return(response) }; diff --git a/src/components/NavBar.js b/src/components/NavBar.js index 80f4742..ecc3f8e 100644 --- a/src/components/NavBar.js +++ b/src/components/NavBar.js @@ -39,8 +39,7 @@ class NavBar extends Component { const mapStateToProps = (state) => { return { - logged_in: state.logged_in, - auth_menu_visible: state.auth_menu_visible + auth: state.auth }; } diff --git a/src/reducers/authReducer.js b/src/reducers/authReducer.js index c6b6b38..164f00d 100644 --- a/src/reducers/authReducer.js +++ b/src/reducers/authReducer.js @@ -7,7 +7,10 @@ const initialState = { export default (state = initialState, action) => { switch (action.type) { case 'USER_LOGIN': - return {...state, ...{jwt: action.payload}} + return {...state, ...{ + jwt: action.payload.data.jwt, + user_logged_in: true + }} default: return state; }