@totvs-agro/core
Version:
Core Totvs Agro (Front-End) para utilização T-Faces
54 lines • 2.21 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var core_1 = require("@angular/core");
var AgroConfigBackEnd = (function () {
function AgroConfigBackEnd() {
var _this = this;
this._carregarConfiguracao(function (json) {
_this.URI_BACKEND = json.url;
_this.URI_TAUTH = json.urlTauth;
});
}
AgroConfigBackEnd.prototype.getBackEnd = function () {
return this.URI_BACKEND;
};
;
AgroConfigBackEnd.prototype.getTauth = function () {
return this.URI_TAUTH ? this.URI_TAUTH : this.URI_BACKEND;
};
;
AgroConfigBackEnd.prototype._carregarConfiguracao = function (callBack) {
var fileConfiguration = window.location.origin;
if (window.location.pathname.split('/')[1]) {
if (window.location.pathname.split('/')[1] === 'modules' && window.location.pathname.split('/').length > 3) {
fileConfiguration = fileConfiguration + '/' + window.location.pathname.split('/')[1] + '/' + window.location.pathname.split('/')[2];
}
else if (window.location.pathname.split('/')[1] === 'pims-web') {
fileConfiguration = fileConfiguration + '/' + window.location.pathname.split('/')[1];
}
}
fileConfiguration = fileConfiguration + '/config/agro.json';
var raw = new XMLHttpRequest();
raw.open("GET", fileConfiguration, false);
raw.onreadystatechange = function () {
if (raw.readyState === 4) {
if (raw.status === 200 || raw.status == 0) {
var response = JSON.parse(raw.responseText);
callBack(response);
}
}
};
raw.send(null);
};
AgroConfigBackEnd.decorators = [
{ type: core_1.Injectable },
];
AgroConfigBackEnd.ctorParameters = function () { return []; };
return AgroConfigBackEnd;
}());
exports.AgroConfigBackEnd = AgroConfigBackEnd;
if (false) {
AgroConfigBackEnd.prototype.URI_BACKEND;
AgroConfigBackEnd.prototype.URI_TAUTH;
}
//# sourceMappingURL=agro.backend.util.js.map