YAY JWTS! ty mark
This commit is contained in:
parent
bbb64c4111
commit
45243c7e26
3 changed files with 5 additions and 4 deletions
|
@ -24,5 +24,4 @@ export const userLogin = (username, password) => async (dispatch) => {
|
|||
password: password
|
||||
})
|
||||
dispatch({ type: 'USER_LOGIN', payload: response })
|
||||
return(response)
|
||||
};
|
||||
|
|
|
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Reference in a new issue