Browse Source

fixed CheckIfConnected async false

master
Petr Balashov 8 years ago
parent
commit
4d4c0bcc6e
  1. 2
      assets/scripts/dashboard.js
  2. 5
      assets/scripts/kmd_wallet/KMDInit.js
  3. 11
      assets/scripts/kmd_wallet_dashboard.js

2
assets/scripts/dashboard.js

@ -1085,7 +1085,7 @@ var Dashboard = function() {
}); });
} }
}, 1000); }, 10000);
var FetchBasiliskData = setInterval(function() { var FetchBasiliskData = setInterval(function() {
var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin'), var active_edexcoin = $('[data-edexcoin]').attr('data-edexcoin'),

5
assets/scripts/kmd_wallet/KMDInit.js

@ -15,7 +15,7 @@ function RunKMDInitFunctions() {
}); });
NProgress.start(); NProgress.start();
var check1 = CheckIfConnected(); function _RunKMDInitFunctions(check1) {
console.log(check1[0]); console.log(check1[0]);
if ( check1[0] == 'not active' ) { if ( check1[0] == 'not active' ) {
console.log('Could not connect to external wallet. Is external wallet running?'); console.log('Could not connect to external wallet. Is external wallet running?');
@ -167,3 +167,6 @@ function RunKMDInitFunctions() {
$('#kmd_wallet_recieve_section').hide(); $('#kmd_wallet_recieve_section').hide();
NProgress.done(); NProgress.done();
} }
CheckIfConnected(_RunKMDInitFunctions);
}

11
assets/scripts/kmd_wallet_dashboard.js

@ -55,7 +55,7 @@ function getPassthruAgent() {
return passthru_agent; return passthru_agent;
} }
function CheckIfConnected() { function CheckIfConnected(cb) {
var result = [], var result = [],
extcoin = $('[data-extcoin]').attr('data-extcoin'), extcoin = $('[data-extcoin]').attr('data-extcoin'),
passthru_agent = getPassthruAgent(), passthru_agent = getPassthruAgent(),
@ -82,7 +82,7 @@ function CheckIfConnected() {
console.log(ajax_data); console.log(ajax_data);
$.ajax({ $.ajax({
async: false, //async: false,
type: 'POST', type: 'POST',
data: JSON.stringify(ajax_data), data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:' + config.iguanaPort, url: 'http://127.0.0.1:' + config.iguanaPort,
@ -98,6 +98,8 @@ function CheckIfConnected() {
} else { } else {
result.push(AjaxOutputData.errors); result.push(AjaxOutputData.errors);
} }
cb.call(this, result);
}, },
error: function(xhr, textStatus, error) { error: function(xhr, textStatus, error) {
console.log('failed getting Coin History.'); console.log('failed getting Coin History.');
@ -107,12 +109,15 @@ function CheckIfConnected() {
} }
console.log(textStatus); console.log(textStatus);
console.log(error); console.log(error);
cb.call(this, result);
} }
}); });
return result; return result;
} }
// TODO: this func is not used anywhere
function CheckIfWalletEncrypted() { function CheckIfWalletEncrypted() {
var result = [], var result = [],
passthru_agent = getPassthruAgent(), passthru_agent = getPassthruAgent(),
@ -195,7 +200,6 @@ function KMD_getInfo_rtrn(cb) {
} }
$.ajax({ $.ajax({
//async: true,
type: 'POST', type: 'POST',
data: JSON.stringify(ajax_data), data: JSON.stringify(ajax_data),
url: 'http://127.0.0.1:' + config.iguanaPort, url: 'http://127.0.0.1:' + config.iguanaPort,
@ -222,6 +226,7 @@ function KMD_getInfo_rtrn(cb) {
} }
console.log(textStatus); console.log(textStatus);
console.log(error); console.log(error);
cb.call(this, result);
} }
}); });

Loading…
Cancel
Save