X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Faccounts%2Fsrc%2Faccount%2FaccountSource.js;h=45da0fb9af570dd17f8305ea7eeda2c9ab211b0e;hp=45067247a3aac77abe2fd4e8d17264e5ae6cea17;hb=0fc4b246b69ecd59401aa6c9bf921b29793d8136;hpb=3130c3b976dc11f641bce038fcfa1c101d156f12 diff --git a/skyquake/plugins/accounts/src/account/accountSource.js b/skyquake/plugins/accounts/src/account/accountSource.js index 45067247a..45da0fb9a 100644 --- a/skyquake/plugins/accounts/src/account/accountSource.js +++ b/skyquake/plugins/accounts/src/account/accountSource.js @@ -34,14 +34,15 @@ module.exports = function(Alt) { return new Promise(function(resolve, reject) { //If socket connection already exists, eat the request. if(state.socket) { + console.log('connection already exists') return resolve(false); } $.ajax({ - url: '//' + window.location.hostname + ':' + NODE_PORT + '/socket-polling?api_server=' + API_SERVER , + url: '/socket-polling?api_server=' + API_SERVER, type: 'POST', beforeSend: Utils.addAuthorizationStub, data: { - url:window.location.protocol + '//' + window.location.host + '/accounts/all?api_server=' + API_SERVER + url: 'accounts/all?api_server=' + API_SERVER }, success: function(data, textStatus, jqXHR) { Utils.checkAndResolveSocketRequest(data, resolve, reject); @@ -49,6 +50,7 @@ module.exports = function(Alt) { }).fail(function(xhr){ //Authentication and the handling of fail states should be wrapped up into a connection class. Utils.checkAuthentication(xhr.status); + reject(xhr.responseText || 'An error occurred. Check your logs for more information'); });; }); }, @@ -132,7 +134,7 @@ module.exports = function(Alt) { }).fail(function(xhr){ //Authentication and the handling of fail states should be wrapped up into a connection class. Utils.checkAuthentication(xhr.status); - reject(); + reject(xhr.responseText || 'An error occurred. Check your logs for more information'); }); }); @@ -176,7 +178,7 @@ module.exports = function(Alt) { }).fail(function(xhr){ //Authentication and the handling of fail states should be wrapped up into a connection class. Utils.checkAuthentication(xhr.status); - reject('error'); + reject(xhr.responseText || 'An error occurred. Check your logs for more information'); }); }); @@ -203,7 +205,7 @@ module.exports = function(Alt) { }).fail(function(xhr){ //Authentication and the handling of fail states should be wrapped up into a connection class. Utils.checkAuthentication(xhr.status); - reject('error'); + reject(xhr.responseText || 'An error occurred. Check your logs for more information'); }); }) },