From 061e803805f4312172b3f74b8f1d1c72fead101e Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 1 Feb 2020 22:48:29 +0100 Subject: [PATCH] fix upload --- Message/Notification/App/AppNotification.js | 2 +- Message/Request/Request.js | 4 ++++ Message/Request/RequestType.js | 3 ++- Views/FormView.js | 5 +++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Message/Notification/App/AppNotification.js b/Message/Notification/App/AppNotification.js index a35727e..e67daa9 100644 --- a/Message/Notification/App/AppNotification.js +++ b/Message/Notification/App/AppNotification.js @@ -55,7 +55,7 @@ export class AppNotification output.querySelector('.log-msg-content').innerHTML = msg.message; tpl.parentNode.appendChild(output); - window.navigator.vibrate(meg.vibrate ? 200 : 0); + window.navigator.vibrate(msg.vibrate ? 200 : 0); setTimeout(function () { diff --git a/Message/Request/Request.js b/Message/Request/Request.js index a8b7f73..76844f4 100644 --- a/Message/Request/Request.js +++ b/Message/Request/Request.js @@ -60,6 +60,8 @@ export class Request return 'application/x-www-form-urlencoded'; case RequestType.FILE: return ''; + case RequestType.FORM_DATA: + return 'multipart/form-data'; default: return 'text/plain'; } @@ -386,6 +388,8 @@ export class Request this.xhr.send(this.data); } else if (this.type === RequestType.URL_ENCODE) { this.xhr.send(this.queryfy(this.data)); + } else if (this.type === RequestType.FORM_DATA) { + this.xhr.send(this.data); } }; }; diff --git a/Message/Request/RequestType.js b/Message/Request/RequestType.js index d2ccb46..7528430 100644 --- a/Message/Request/RequestType.js +++ b/Message/Request/RequestType.js @@ -10,5 +10,6 @@ export const RequestType = Object.freeze({ JSON: 'json', RAW: 'raw', FILE: 'file', - URL_ENCODE: 'url' + URL_ENCODE: 'url', + FORM_DATA: 'formdata' }); diff --git a/Views/FormView.js b/Views/FormView.js index 3069423..f3b65f6 100644 --- a/Views/FormView.js +++ b/Views/FormView.js @@ -317,6 +317,11 @@ export class FormView } for (let i = 0; i < externalLength; ++i) { + if (form.contains(external[i])) { + delete external[i]; + continue; + } + if ((external[i].type === 'checkbox' || external[i].type === 'radio') && !external[i].checked) { delete external[i]; }