Local storage support
This commit is contained in:
1 parent
64a60e07ef
commit
00b5a1c785
2 files changed
+18
-18
No files matched your search
+6
-12
@@ -136,34 +136,28 @@ function loadAdvancedAlgosPlatform() {
|
||||
}
|
||||
|
||||
function callServer(pContentToSend, pPath, callBackFunction) {
|
||||
|
||||
let xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function () {
|
||||
if (this.readyState === 4 && this.status === 200) {
|
||||
|
||||
callBackFunction(xhttp.responseText);
|
||||
|
||||
callBackFunction(GLOBAL.DEFAULT_OK_RESPONSE, xhttp.responseText);
|
||||
return;
|
||||
} else if (this.readyState === 4 && this.status === 404) {
|
||||
callBackFunction({ result: "Fail", message: xhttp.responseText.trim(), code: xhttp.responseText.trim() });
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
if (pContentToSend === undefined) {
|
||||
|
||||
xhttp.open("GET", pPath, true);
|
||||
xhttp.send();
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
|
||||
let blob = new Blob([pContentToSend], { type: 'text/plain' });
|
||||
|
||||
xhttp.open("POST", pPath, true);
|
||||
xhttp.send(blob);
|
||||
|
||||
} catch (err) {
|
||||
|
||||
if (ERROR_LOG === true) { console.log(spacePad(MODULE_NAME, 50) + " : " + "[ERROR] callServer -> err.message = " & err.message); }
|
||||
|
||||
callBackFunction({ result: "Fail", message: err.message })
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user