async/await in delete interface to avoid a whole indent level

This commit is contained in:
Alexandre Aubin 2017-07-20 21:14:11 -04:00
parent 88a30a6656
commit f8452bdcc5

View file

@ -101,14 +101,12 @@ async function sha256(message) {
/* END SHA256 CODE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
function sendDeleteRequest()
async function sendDeleteRequest()
{
// Compute 'true' password
var domain = document.getElementById("domain").value;
var user_password = document.getElementById("password").value;
var true_password;
sha256(domain+":"+user_password).then(function(d) {
var true_password = d;
var true_password = await sha256(domain+":"+user_password);
// Prepare request
var url = "./domains/"+domain
@ -139,7 +137,6 @@ function sendDeleteRequest()
xhttp.open("DELETE", url, true);
xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhttp.send(params);
})
}
</script>