1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-13 23:20:05 +00:00

chore(sasjs-tests): use test framework in SASjs Tests

This commit is contained in:
Krishna Acondy
2020-07-22 19:42:34 +01:00
parent 9742f53dde
commit 69d088a9c6
21 changed files with 29 additions and 600 deletions

View File

@@ -1,23 +0,0 @@
export const uploadFile = (file: File, fileName: string, url: string) => {
return new Promise((resolve, reject) => {
const data = new FormData();
data.append("file", file);
data.append("filename", fileName);
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === 4) {
let response: any;
try {
response = JSON.parse(this.responseText);
} catch (e) {
reject(e);
}
resolve(response);
}
});
xhr.open("POST", url);
xhr.setRequestHeader("cache-control", "no-cache");
xhr.send(data);
});
};