bug fix in JSON serialization
This commit is contained in:
+4
-2
@@ -1,13 +1,15 @@
|
||||
import axios from 'axios';
|
||||
import Utils from '@/lib/Utils';
|
||||
|
||||
const $ax = axios.create({
|
||||
baseURL: '/api/',
|
||||
transformRequest: [
|
||||
(data, headers)=>{
|
||||
if (data && !(data instanceof FormData)){
|
||||
data = JSON.stringify(data, (k, v)=>{
|
||||
data = Utils.deepMerge({}, data, (k, v)=>{
|
||||
return k.startsWith('__') ? undefined : v;
|
||||
});
|
||||
})
|
||||
data = JSON.stringify(data);
|
||||
headers['Content-Type'] = 'application/json;charset=utf-8';
|
||||
}
|
||||
return data;
|
||||
|
||||
Reference in New Issue
Block a user