Skip to content

Commit

Permalink
Service
Browse files Browse the repository at this point in the history
  • Loading branch information
Quickcorp committed Apr 29, 2018
1 parent 448d2bf commit 938cb0c
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions QCObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@
templateURI:'',
url:'',
method:'GET',
data:'',
data:{},
reload:false,
set:function (name,value){
this[name]=value;
Expand All @@ -649,6 +649,21 @@
}
});

Class('Service',Object,{
domain:window.location.host.toLowerCase(),
basePath:basePath,
url:'',
method:'GET',
data:{},
reload:false,
set:function (name,value){
this[name]=value;
},
get:function (name){
return this[name];
}
});

Class('VO',Object,{});

/**
Expand Down Expand Up @@ -747,7 +762,8 @@
var _serviceLoader = function(service, _async) {
logger.debug('LOADING SERVICE DATA {{DATA}} FROM {{URL}}'.replace('{{DATA}}', JSON.stringify(service.data)).replace('{{URL}}', service.url));
var xhr = new XMLHttpRequest();
xhr.open(service.method, service.url);
xhr.withCredentials = service.headers.hasOwnProperty('Authorization');
xhr.open(service.method, service.url,true);
for (var header in service.headers){
xhr.setRequestHeader(header, service.headers[header]);
}
Expand Down

0 comments on commit 938cb0c

Please sign in to comment.