diff --git a/src/actions/index.js b/src/actions/index.js index 41ab73a..54f3775 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -28,8 +28,9 @@ export const userLogin = (username, password) => async (dispatch) => { dispatch({ type: 'USER_LOGIN', payload: null }) } if (response.status === 200) { - console.log(document.cookie) - dispatch({ type: 'USER_LOGIN', payload: response }) + var v = document.cookie.match('(^|;) ?DataCookie=([^;]*)(;|$)'); + var DataCookie = v ? v[2] : null; + dispatch({ type: 'USER_LOGIN', payload: DataCookie}) } }; diff --git a/src/reducers/authReducer.js b/src/reducers/authReducer.js index 6595621..c6e5d87 100644 --- a/src/reducers/authReducer.js +++ b/src/reducers/authReducer.js @@ -11,7 +11,7 @@ export default (state = initialState, action) => { return {...state, ...action.data} case 'USER_LOGIN': if (action.payload) { - var data = JSON.parse(atob(action.payload.data.split('.')[1])) + var data = JSON.parse(atob(action.payload.split('.')[1])) return {...state, ...{ user_authed: true, username: data.username,