backups: upload and restore backup in-app

This commit is contained in:
Harvey Tindall
2023-12-21 18:12:58 +00:00
parent eff313be41
commit ade032241a
5 changed files with 51 additions and 3 deletions
+9
View File
@@ -56,6 +56,15 @@ export const _download = (url: string, fname: string): void => {
req.send();
};
export const _upload = (url: string, formData: FormData): void => {
let req = new XMLHttpRequest();
if (window.URLBase) { url = window.URLBase + url; }
req.open("POST", url, true);
req.setRequestHeader("Authorization", "Bearer " + window.token);
// req.setRequestHeader('Content-Type', 'multipart/form-data');
req.send(formData);
};
export const _post = (url: string, data: Object, onreadystatechange: (req: XMLHttpRequest) => void, response?: boolean, statusHandler?: (req: XMLHttpRequest) => void): void => {
let req = new XMLHttpRequest();
req.open("POST", window.URLBase + url, true);