How should axios write with token request?

reqwest ({

)
            url: "http://123.456.789/api/",
            type: "json",
            headers: Cookies.get("token") ? {"Authorization": "Token " + Cookies.get("token")} : {},
            success: function (resp) {
                console.log(resp);
            },

        });
        
        
        reqwesttokenaxiosaxios
Apr.07,2021

https://www.kancloud.cn/yunye.


It's the same thing.

axios.create({
  url: 'http://123.456.789/api/',
  method: 'get', //  get
  headers: Cookies.get('token') ? {'Authorization': 'Token ' + Cookies.get('token')} : {},
}).then(res => {})
Menu