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
|
password: password
|
||||||
})
|
})
|
||||||
dispatch({ type: 'USER_LOGIN', payload: response })
|
dispatch({ type: 'USER_LOGIN', payload: response })
|
||||||
return(response)
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,8 +39,7 @@ class NavBar extends Component {
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
return {
|
return {
|
||||||
logged_in: state.logged_in,
|
auth: state.auth
|
||||||
auth_menu_visible: state.auth_menu_visible
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,10 @@ const initialState = {
|
||||||
export default (state = initialState, action) => {
|
export default (state = initialState, action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'USER_LOGIN':
|
case 'USER_LOGIN':
|
||||||
return {...state, ...{jwt: action.payload}}
|
return {...state, ...{
|
||||||
|
jwt: action.payload.data.jwt,
|
||||||
|
user_logged_in: true
|
||||||
|
}}
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue