I'm trying to pass a team
object a league_id
integer as parameters to my post request. But I can only seem to get the team params to pass...
Here is what I'm working with:
onSubmit: function () {
axios.post('/api/v1/teams', {team: {name: this.$refs.team_name.value}, league_id: this.$route.params.id}, {
headers: {
Authorization: "Bearer "+localStorage.getItem('token')
}
}).then(response => {
this.$router.push('/')
}).catch(error => {
this.$router.push('/create_team')
})
}
This is what my server receives:
%{"team" => %{"name" => "face"}}
I want it to look like this:
%{"team" => %{"name" => "face"}, "league_id" => 15}
How can I form this request with Axios?
可能是因为您的为null或未定义。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.