I am currently using Redux and I want to send the state and request it in the backend. Code below.
const { email } = useSelector((state) => state.user);
const getConcern = async () => {
const { data } = await axios
.get("http://localhost:5000/Student/", { email })
.catch((err) => console.log(err.message));
console.log(email);
console.log(data);
};
And I am trying to log it in the console in the backend but it results as undefined?
const getConcerns = async (req, res) => {
const { email } = req.body;
console.log(email);
const concerns = await Concerns.find();
res.status(200).json(concerns);
};
How can I send the email in the current state and pass it into the backend as a GET method? Please help, thanks.