I try to request user data with req.query but I have trouble like my title question. previously I try with other models and it worked.
controller.js (server side)
static getUserByQuery(req, res, next) {
User
.find(req.query)
.then(user => {
res.status(200).json(user);
})
.catch(next);
};
my vuex on actions state (client side)
getUserByQuery(context, email) {
Axios
.get(`${baseUrl}/user/find?email=${email}`)
.then(({ data }) => {
context.commit('GET_USER_BY_QUERY', data);
})
.catch((err) => {
console.log(err.message);
});
},
I use email for sample query, and I hope can be used with other queries.