Skip to content
Snippets Groups Projects
Commit 9da9cf3d authored by Gabriel Zachmann's avatar Gabriel Zachmann Committed by Gabriel Zachmann
Browse files

[web] exchange transfer code on enter

parent 1e67956e
No related branches found
No related tags found
No related merge requests found
Pipeline #323247 passed
const $tcInput = $('#tc-input');
function createTransferCode(token, okCallback, errCallback, endpoint = "") {
let data = {'mytoken': token};
data = JSON.stringify(data);
......@@ -20,7 +22,7 @@ function createTransferCode(token, okCallback, errCallback, endpoint = "") {
}
function exchangeTransferCode() {
let tc = $('#tc-input').val();
let tc = $tcInput.val();
$.ajax({
type: "POST",
url: storageGet("mytoken_endpoint"),
......@@ -40,4 +42,11 @@ function exchangeTransferCode() {
dataType: "json",
contentType: "application/json"
});
}
\ No newline at end of file
}
$tcInput.on('keyup', function (e) {
if (e.keyCode === 13) { // Enter
e.preventDefault();
exchangeTransferCode();
}
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment