One more tiny error refactor
This commit is contained in:
parent
68131a6e2a
commit
56433bd9af
2 changed files with 8 additions and 13 deletions
|
@ -111,17 +111,11 @@ window.textsecure.api = function() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.requestVerificationCode = function(number, success_callback, error_callback) {
|
self.requestVerificationCode = function(number) {
|
||||||
doAjax({
|
doAjax({
|
||||||
call : 'accounts',
|
call : 'accounts',
|
||||||
httpType : 'GET',
|
httpType : 'GET',
|
||||||
urlParameters : '/sms/code/' + number,
|
urlParameters : '/sms/code/' + number,
|
||||||
}).then(function(response) {
|
|
||||||
if (success_callback !== undefined)
|
|
||||||
success_callback(response);
|
|
||||||
}).catch(function(code) {
|
|
||||||
if (error_callback !== undefined)
|
|
||||||
error_callback(code);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -59,12 +59,13 @@ $('#init-go-single-client').click(function() {
|
||||||
|
|
||||||
single_device = true;
|
single_device = true;
|
||||||
|
|
||||||
textsecure.api.requestVerificationCode(number,
|
textsecure.api.requestVerificationCode(number).catch(function(error) {
|
||||||
function(response) { },
|
//TODO: No alerts
|
||||||
function(code) {
|
if (error.humanReadable)
|
||||||
alert("Failed to send key?" + code); //TODO
|
alert(error.humanReadable);
|
||||||
}
|
else
|
||||||
);
|
alert(error); // XXX
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#init-go').click(function() {
|
$('#init-go').click(function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue