Skip to content

Commit

Permalink
Merge pull request #63 from vania-pooh/master
Browse files Browse the repository at this point in the history
Correctly printing license generation error
  • Loading branch information
vania-pooh authored Nov 14, 2019
2 parents afe3487 + ad00ede commit 4aa58ef
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,17 @@ document.addEventListener("DOMContentLoaded", () => {
notify("#d32f2f", message);
};
window.onSubmit = function() {
$.post(apiEndpoint, $("form#license-form").serialize())
.done(function(evt, status, xhr) {
if (xhr.status === 200) {
success("An evaluation license key was sent to your email address");
} else {
failure(`An error while requesting evaluation license key: ${xhr.statusText}`);
}
$.ajax({
url: apiEndpoint,
data: $("form#license-form").serialize(),
success: function() {
success("An evaluation license key was sent to your email address");
reset();
})
.fail(function(e) {
failure(`Failed to request evaluation license key: ${e.statusText}`);
},
error: function(xhr) {
failure(`Failed to request evaluation license key: ${xhr.responseText}`);
reset();
});
}
});
};
});

0 comments on commit 4aa58ef

Please sign in to comment.