Reputation: 145
I have been trying to make work a very simple redux store but when trying to access it it says inPromise
Already tried to debug by using console.log() but im not able to find the error
token = undefined state = {auth: Promise} auth: Promise {<resolved>: {…}} __proto__: Object
const mapStateToProps = (state) =>{ console.log(state) return{ isAuthenticated:state.auth.token !== null, token:state } }
reducer creation
const authReducer = async (state =INITIAL_STATE, action) => { switch (action.type){ case actionTypes.AUTH_START: return authStart(state, action); case actionTypes.AUTH_SUCCESS: return authSuccess(state, action); case actionTypes.AUTH_FAIL: return authFail(state,action); case actionTypes.AUTH_LOGOUT: return authLogout(state,action); default: return state; } }
and root reducer
export default combineReducers({ auth: authReducer });
and store creation
const middlewares = [logger, thunk] const store = createStore(rootReducer,applyMiddleware(...middlewares))
Upvotes: 0
Views: 32