Axios post requests nested objects. When passing parameters, the nested objects become [object Object]

request of the requested object

   

Apr.07,2021

JSON.stringify(req)

I tried not to, did you use qs to transfer


found that he accidentally wrote an axios decorator code:

axios.interceptors.request.use(function (config) {
    console.log(config);
    config.transformRequest = [function (data) {
        let ret = '';
        for (let it in data) {
            ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&';
        }
        return ret;
    }];
    // 
    return config;
}, function (error) {
    // 
    return Promise.reject(error);
});
Menu