Axios params not appending correctly to URL

Viewed 2642

I'm trying to use params for a post request using Axios. However, when I check the XHR in Chrome, the params don't seem to be appended to the URL.

If I do this, it works:

axios.post('/!/Like/like?id=' + this.id + '&_token=' + this.csrf_token)

But if I try this, I get an error:

axios.post('/!/Like/like', {
    params: {
        id: this.id,
        _token: this.csrf_token
    }
})

In other words, the url needs to be:

/!/Like/like?id=1234&_token=zYXW-123

Any ideas what I might be doing wrong?

1 Answers
Related