mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-06-29 01:36:44 +03:00
Move the "upload EML file to mailbox" Append feature into a DoFolderAppend()
This commit is contained in:
parent
fb2eb62f83
commit
5216535278
8 changed files with 102 additions and 145 deletions
22
dev/bootstrap.js
vendored
22
dev/bootstrap.js
vendored
|
|
@ -44,21 +44,31 @@ export default App => {
|
|||
}, init);
|
||||
if (postData) {
|
||||
init.method = 'POST';
|
||||
init.headers['Content-Type'] = 'application/json';
|
||||
let asJSON = 1,
|
||||
XToken = Settings.app('token'),
|
||||
object = {};
|
||||
if (postData instanceof FormData) {
|
||||
const object = {};
|
||||
postData.forEach((value, key) => {
|
||||
if (!Reflect.has(object, key)){
|
||||
if (value instanceof File) {
|
||||
asJSON = 0;
|
||||
} else if (!Reflect.has(object, key)) {
|
||||
object[key] = value;
|
||||
} else {
|
||||
isArray(object[key]) || (object[key] = [object[key]]);
|
||||
object[key].push(value);
|
||||
}
|
||||
});
|
||||
postData = object;
|
||||
if (asJSON) {
|
||||
postData = object;
|
||||
} else {
|
||||
postData.set('XToken', XToken);
|
||||
}
|
||||
}
|
||||
postData.XToken = Settings.app('token');
|
||||
init.body = JSON.stringify(postData);
|
||||
if (asJSON) {
|
||||
init.headers['Content-Type'] = 'application/json';
|
||||
postData = JSON.stringify(postData);
|
||||
}
|
||||
init.body = postData;
|
||||
}
|
||||
init.headers['X-SM-Token'] = Settings.app('token');
|
||||
// init.headers = new Headers(init.headers);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue