Rewrite jquery ajax request in axios and set xhrFi

2019-07-19 14:33发布

问题:

i HAVE jquery request

$.ajax({
    type: "GET",
    url: "http://6232423.212342343.100.89:9000/api/v2/content/categories/",
    xhrFields: {
        withCredentials: true
    },
});

how do I make the same but in axios? I tried like this:

axios.get(portal.categoriesUrl,
          {xhrFields: {
        withCredentials: true
    }}
)

but didn't work

回答1:

axios.get(url, { withCredentials: true })

see docs https://github.com/mzabriskie/axios



标签: vue.js axios