still refactoring some promise stuff

This commit is contained in:
quenousimporte 2023-09-21 21:55:59 +02:00
parent fc3ffcc681
commit d63621387e
1 changed files with 26 additions and 28 deletions

12
main.js
View File

@ -423,7 +423,7 @@ function decryptstring(str)
{ {
if (!str.startsWith("-----BEGIN PGP MESSAGE-----")) if (!str.startsWith("-----BEGIN PGP MESSAGE-----"))
{ {
console.log("string is not encrypted"); // console.log(str + ": string is not encrypted");
return Promise.resolve(str); return Promise.resolve(str);
} }
console.log("decrypting..."); console.log("decrypting...");
@ -1540,8 +1540,7 @@ function queryremote(params)
else else
{ {
var data = {}; var data = {};
try
{
decryptstring(xhr.responseText) decryptstring(xhr.responseText)
.then(decrypted => .then(decrypted =>
{ {
@ -1569,12 +1568,11 @@ function queryremote(params)
notepage.style.display = "table"; notepage.style.display = "table";
apply(data); apply(data);
} }
}); })
} .catch( error =>
catch(error)
{ {
failed("Handler result is not valid. JS error: " + error); failed("Handler result is not valid. JS error: " + error);
} });
} }
} }