From 216a600224fde22ce76b367557a02094ec693886 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 1 Dec 2023 20:04:13 -0800 Subject: prettier --- src/lib/upload.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/lib/upload.js') diff --git a/src/lib/upload.js b/src/lib/upload.js index 92f5290f..552e4a7a 100644 --- a/src/lib/upload.js +++ b/src/lib/upload.js @@ -1,19 +1,19 @@ export const upload = async (file, type, progress, token) => { - let url = `/api/upload/${type}`; - let formData = new FormData(); - formData.append('file', file); + let url = `/api/upload/${type}`; + let formData = new FormData(); + formData.append("file", file); - return new Promise((resolve, reject) => { - let ajax = new XMLHttpRequest(); - ajax.addEventListener('load', () => { - if (ajax.readyState === ajax.DONE) { - if (ajax.status === 200) resolve(ajax.response); - else reject(new Error(`Upload failed: ${ajax.response}`)); - } - }); - ajax.upload.addEventListener('progress', progress, false); - ajax.open('POST', url); - // ajax.setRequestHeader('Authorization', `Bearer ${token}`); - ajax.send(formData); - }); + return new Promise((resolve, reject) => { + let ajax = new XMLHttpRequest(); + ajax.addEventListener("load", () => { + if (ajax.readyState === ajax.DONE) { + if (ajax.status === 200) resolve(ajax.response); + else reject(new Error(`Upload failed: ${ajax.response}`)); + } + }); + ajax.upload.addEventListener("progress", progress, false); + ajax.open("POST", url); + // ajax.setRequestHeader('Authorization', `Bearer ${token}`); + ajax.send(formData); + }); }; -- cgit v1.2.3