Reputation: 1905
How can I pass query paramenters using Axios such that I can get the query in my backend code using req.query.email
. This doesn't seem to work:
this.$http.post(this.$BASE_URL + 'agents/auth/create-password', {
data: { password: this.password },
params: {
email,
},
})
.then((res) => {
console.log(res);
})
.catch((error) => {
console.log(error);
})
What I'm getting from my api is req.body.data
and req.body.params
.
Upvotes: 0
Views: 93
Reputation: 61
const querystring = require('querystring');
axios.post('http://something.com/', querystring.stringify({ foo: 'bar' }));
For more information have a look on https://github.com/axios/axios#query-string.
Upvotes: 1