diff --git a/package.json b/package.json index 658bbae..c5d3808 100755 --- a/package.json +++ b/package.json @@ -59,4 +59,4 @@ "dependencies": { "dropzone": "^5.5.1" } -} \ No newline at end of file +} diff --git a/src/components/vue-dropzone.vue b/src/components/vue-dropzone.vue index ff90910..7ecdbce 100755 --- a/src/components/vue-dropzone.vue +++ b/src/components/vue-dropzone.vue @@ -49,7 +49,7 @@ export default { required: false } }, - data() { + data: function() { return { isS3: false, isS3OverridesServerPropagation: false, @@ -57,7 +57,7 @@ export default { }; }, computed: { - dropzoneSettings() { + dropzoneSettings: function() { let defaultValues = { thumbnailWidth: 200, thumbnailHeight: 200 @@ -74,7 +74,7 @@ export default { this.wasQueueAutoProcess = this.options.autoProcessQueue; //eslint-disable-line if (this.isS3OverridesServerPropagation) { - defaultValues["url"] = files => { + defaultValues["url"] = function(files) { return files[0].s3Url; }; } @@ -82,7 +82,7 @@ export default { return defaultValues; } }, - mounted() { + mounted: function() { if (this.$isServer && this.hasBeenMounted) { return; } @@ -267,7 +267,7 @@ export default { vm.$emit("vdropzone-mounted"); }, - beforeDestroy() { + beforeDestroy: function () { if (this.destroyDropzone) this.dropzone.destroy(); }, methods: { @@ -316,7 +316,7 @@ export default { processQueue: function() { let dropzoneEle = this.dropzone; if (this.isS3 && !this.wasQueueAutoProcess) { - this.getQueuedFiles().forEach(file => { + this.getQueuedFiles().forEach(function (file) { this.getSignedAndUploadToS3(file); }); } else { @@ -389,17 +389,19 @@ export default { getActiveFiles: function() { return this.dropzone.getActiveFiles(); }, - getSignedAndUploadToS3(file) { + getSignedAndUploadToS3: function(file) { var promise = awsEndpoint.sendFile( file, this.awss3, this.isS3OverridesServerPropagation ); if (!this.isS3OverridesServerPropagation) { - promise.then(response => { + promise.then(function (response) { if (response.success) { file.s3ObjectLocation = response.message; - setTimeout(() => this.dropzone.processFile(file)); + setTimeout(function () { + this.dropzone.processFile(file) + }); this.$emit("vdropzone-s3-upload-success", response.message); } else { if ("undefined" !== typeof response.message) { @@ -413,15 +415,17 @@ export default { } }); } else { - promise.then(() => { - setTimeout(() => this.dropzone.processFile(file)); + promise.then(function () { + setTimeout(function () { + this.dropzone.processFile(file) + }); }); } - promise.catch(error => { + promise.catch(function (error) { alert(error); }); }, - setAWSSigningURL(location) { + setAWSSigningURL: function(location) { if (this.isS3) { this.awss3.signingURL = location; } diff --git a/src/services/urlsigner.js b/src/services/urlsigner.js index e39f65f..7eb008b 100755 --- a/src/services/urlsigner.js +++ b/src/services/urlsigner.js @@ -1,11 +1,11 @@ export default { - getSignedURL(file, config) { + getSignedURL: function(file, config) { let payload = { filePath: file.name, contentType: file.type } - return new Promise((resolve, reject) => { + return new Promise(function (resolve, reject) { var fd = new FormData(); let request = new XMLHttpRequest(), signingURL = (typeof config.signingURL === "function") ? config.signingURL(file) : config.signingURL; @@ -24,29 +24,29 @@ export default { if (config.withCredentials === true) { request.withCredentials = true; } - Object.entries(config.headers || {}).forEach(([name, value]) => { + Object.entries(config.headers || {}).forEach(function (name, value) { request.setRequestHeader(name, value); }); payload = Object.assign(payload, config.params || {}); - Object.entries(payload).forEach(([name, value]) => { + Object.entries(payload).forEach(function (name, value) { fd.append(name, value); }); request.send(fd); }); }, - sendFile(file, config, is_sending_s3) { + sendFile: function(file, config, is_sending_s3) { var handler = (is_sending_s3) ? this.setResponseHandler : this.sendS3Handler; return this.getSignedURL(file, config) - .then((response) => {return handler(response, file)}) - .catch((error) => { return error; }); + .then(function (response) {return handler(response, file)}) + .catch(function (error) { return error; }); }, - setResponseHandler(response, file) { + setResponseHandler: function (response, file) { file.s3Signature = response.signature; file.s3Url = response.postEndpoint; }, - sendS3Handler(response, file) { + sendS3Handler: function(response, file) { let fd = new FormData(), signature = response.signature; @@ -54,7 +54,7 @@ export default { fd.append(key, signature[key]); }); fd.append('file', file); - return new Promise((resolve, reject) => { + return new Promise(function (resolve, reject) { let request = new XMLHttpRequest(); request.open('POST', response.postEndpoint); request.onload = function () {