mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +03:00
Bugfix: new AbstractAjaxRemote failed with recursive values like the Attachments
This commit is contained in:
parent
a5a15c8e11
commit
6f49e9b80f
1 changed files with 11 additions and 4 deletions
|
|
@ -152,10 +152,17 @@ class AbstractAjaxRemote {
|
||||||
};
|
};
|
||||||
params.XToken = Settings.appSettingsGet('token');
|
params.XToken = Settings.appSettingsGet('token');
|
||||||
// init.body = JSON.stringify(params);
|
// init.body = JSON.stringify(params);
|
||||||
const formData = new FormData();
|
const formData = new FormData(),
|
||||||
Object.keys(params).forEach(key => {
|
buildFormData = (formData, data, parentKey) => {
|
||||||
formData.append(key, params[key])
|
if (data && typeof data === 'object' && !(data instanceof Date || data instanceof File)) {
|
||||||
});
|
Object.entries(data).forEach(([key,value]) => {
|
||||||
|
buildFormData(formData, value, parentKey ? `${parentKey}[${key}]` : key);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
formData.append(parentKey, data == null ? '' : data);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
buildFormData(formData, params);
|
||||||
init.body = (new URLSearchParams(formData)).toString();
|
init.body = (new URLSearchParams(formData)).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue