Reputation: 313
I'm dispatching an action, which gets a response from a route in this format :
res.json({
token,
user: {
id: user.id,
email: user.email,
password: user.password,
},
})
The promise does resolve and the new user is saved to the DB. But on the reducer, which looks like this :
case ADD_USER:
console.log(`payload is ${action.payload.user}`)
return {
...state,
users: [...state.users, action.payload.user],
}
The payload I get in chrome console is this :
payload is [object Object]
Which should look like this :
user: {
id: '5ea737af99a72f29d4864843',
email: '[email protected]',
password: '$2a$10$wqVQaOFTTD5nTB/eQN79xuSlFy0gQ8kgz3QKuB86BVs1ke6MMPFX6'
}
The data is stored correctly in state and I can see it in Redux Dev tools,
But how can I see the console.log right too?
Upvotes: 0
Views: 646