mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +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');
|
||||
// init.body = JSON.stringify(params);
|
||||
const formData = new FormData();
|
||||
Object.keys(params).forEach(key => {
|
||||
formData.append(key, params[key])
|
||||
});
|
||||
const formData = new FormData(),
|
||||
buildFormData = (formData, data, parentKey) => {
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue