1
0
Fork 0

YAY JWTS! ty mark

This commit is contained in:
Amarpreet Minhas 2019-09-16 21:04:31 -04:00
parent bbb64c4111
commit 45243c7e26
3 changed files with 5 additions and 4 deletions

View file

@ -24,5 +24,4 @@ export const userLogin = (username, password) => async (dispatch) => {
password: password
})
dispatch({ type: 'USER_LOGIN', payload: response })
return(response)
};

View file

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

View file

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