info-library 2.14.21 → 2.14.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/model/app-config.model.mjs +2 -1
- package/esm2020/service/authentication.service.mjs +4 -4
- package/esm2020/service/data.service.mjs +10 -4
- package/fesm2015/info-library.mjs +13 -6
- package/fesm2015/info-library.mjs.map +1 -1
- package/fesm2020/info-library.mjs +13 -6
- package/fesm2020/info-library.mjs.map +1 -1
- package/model/app-config.model.d.ts +1 -0
- package/package.json +1 -1
- package/service/data.service.d.ts +1 -0
|
@@ -69,6 +69,7 @@ class InfoAppConfigModel {
|
|
|
69
69
|
this.topMenu = false;
|
|
70
70
|
this.enabledPrime = false;
|
|
71
71
|
this.title = '';
|
|
72
|
+
this.headers = [];
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
|
|
@@ -592,8 +593,14 @@ class InfoDataService {
|
|
|
592
593
|
else
|
|
593
594
|
return 'Bearer ' + this.token;
|
|
594
595
|
}
|
|
596
|
+
getHeaderDefault() {
|
|
597
|
+
let headers = new HttpHeaders();
|
|
598
|
+
if (this._plataforma.Config.headers != null)
|
|
599
|
+
this._plataforma.Config.headers.forEach(item => headers = headers.set(item.key, item.value));
|
|
600
|
+
return headers;
|
|
601
|
+
}
|
|
595
602
|
getHeaderToken() {
|
|
596
|
-
return
|
|
603
|
+
return this.getHeaderDefault().set('Authorization', this.getToken());
|
|
597
604
|
}
|
|
598
605
|
getAPIUrl(controller) {
|
|
599
606
|
let api = '';
|
|
@@ -605,7 +612,7 @@ class InfoDataService {
|
|
|
605
612
|
}
|
|
606
613
|
getNoToken(controller, method, param) {
|
|
607
614
|
return this._http
|
|
608
|
-
.get(this.getAPIUrl(controller) + (method || '').toLowerCase() + (param == null ? '' : ('?' + param.replace(/null/g, '').replace(/undefined/g, ''))))
|
|
615
|
+
.get(this.getAPIUrl(controller) + (method || '').toLowerCase() + (param == null ? '' : ('?' + param.replace(/null/g, '').replace(/undefined/g, ''))), { headers: this.getHeaderDefault() })
|
|
609
616
|
.pipe(map(r => new InfoDataAccessModel(r)), catchError((e) => this.errorHandling(e)));
|
|
610
617
|
}
|
|
611
618
|
get(controller, method, param) {
|
|
@@ -620,7 +627,7 @@ class InfoDataService {
|
|
|
620
627
|
}
|
|
621
628
|
postNoToken(controller, model, method) {
|
|
622
629
|
return this._http
|
|
623
|
-
.post(this.getAPIUrl(controller) + (method || '').toLowerCase(), model)
|
|
630
|
+
.post(this.getAPIUrl(controller) + (method || '').toLowerCase(), model, { headers: this.getHeaderDefault() })
|
|
624
631
|
.pipe(map(r => new InfoDataAccessModel(r)), catchError((e) => this.errorHandling(e)));
|
|
625
632
|
}
|
|
626
633
|
post(controller, model, method) {
|
|
@@ -1086,7 +1093,7 @@ class InfoAuthenticationService {
|
|
|
1086
1093
|
login(usuario, senha, reCaptchaToken = null, codigo2FA = null) {
|
|
1087
1094
|
this.removeSessao();
|
|
1088
1095
|
return this._http
|
|
1089
|
-
.post(this._plataforma.Config.webapiUrl + 'centrocontrole/usuario/autenticar', { Usuario: usuario, Senha: senha, ReCaptchaToken: reCaptchaToken, Codigo2FA: codigo2FA })
|
|
1096
|
+
.post(this._plataforma.Config.webapiUrl + 'centrocontrole/usuario/autenticar', { Usuario: usuario, Senha: senha, ReCaptchaToken: reCaptchaToken, Codigo2FA: codigo2FA }, { headers: this._dataService.getHeaderDefault() })
|
|
1090
1097
|
.pipe(map((r) => {
|
|
1091
1098
|
if (r.Success && r.Data != null)
|
|
1092
1099
|
this._utilities.setLocalStorage(this._plataforma.TokenKey, r.Data.Token);
|
|
@@ -1150,12 +1157,12 @@ class InfoAuthenticationService {
|
|
|
1150
1157
|
}
|
|
1151
1158
|
setResetarSenha(model) {
|
|
1152
1159
|
return this._http
|
|
1153
|
-
.post(this._plataforma.Config.webapiUrl + 'centrocontrole/usuario/ResetarSenha', model)
|
|
1160
|
+
.post(this._plataforma.Config.webapiUrl + 'centrocontrole/usuario/ResetarSenha', model, { headers: this._dataService.getHeaderDefault() })
|
|
1154
1161
|
.pipe(map((r) => new InfoLoginModel(r.Success, r.Messages, r.Data)), catchError((e) => this.errorHandling(e)));
|
|
1155
1162
|
}
|
|
1156
1163
|
getLoginResources() {
|
|
1157
1164
|
return this._http
|
|
1158
|
-
.get(this._plataforma.Config.webapiUrl + 'centrocontrole/app/GetLoginResources')
|
|
1165
|
+
.get(this._plataforma.Config.webapiUrl + 'centrocontrole/app/GetLoginResources', { headers: this._dataService.getHeaderDefault() })
|
|
1159
1166
|
.pipe(map((r) => new InfoLoginModel(r.Success, r.Messages, r.Data)), catchError((e) => this.errorHandling(e)));
|
|
1160
1167
|
}
|
|
1161
1168
|
hasPermission(url, keyFunction = 'view') {
|