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; }