after login button press I want to check whether fields are empty or not. But I faced this error.
Error: Actions must be plain objects. Use custom middleware for async actions. This is my code.
export const loginUser = (user) => {
return (dispatch) => {
console.log("checker");
axios.post('/api/users/login', user)
.then(res => {
console.log(res.data);
})
.catch(err => {
dispatch({
type: GET_ERRORS,
payload: err.response.data
});
});
}
}