ngx-sp-auth 4.23.14 → 4.23.16
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/fesm2022/ngx-sp-auth.mjs +60 -5
- package/fesm2022/ngx-sp-auth.mjs.map +1 -1
- package/lib/components/login-os/login-os-utils.service.d.ts +13 -0
- package/lib/components/login-os/login-os.component.d.ts +1 -0
- package/lib/components/menu-lateral/model/ret-estabelecimento-session.d.ts +1 -0
- package/package.json +1 -1
package/fesm2022/ngx-sp-auth.mjs
CHANGED
|
@@ -2318,6 +2318,40 @@ class LoginOSModel {
|
|
|
2318
2318
|
}
|
|
2319
2319
|
}
|
|
2320
2320
|
|
|
2321
|
+
class LoginOSUtilsService {
|
|
2322
|
+
// #endregion PRIVATE
|
|
2323
|
+
// #endregion ==========> PROPERTIES <==========
|
|
2324
|
+
constructor() {
|
|
2325
|
+
// #region ==========> PROPERTIES <==========
|
|
2326
|
+
// #region PRIVATE
|
|
2327
|
+
this._http = inject(HttpClient);
|
|
2328
|
+
this._customEnvironment = inject(LibCustomEnvironmentService);
|
|
2329
|
+
this._BASE_URL = `${this._customEnvironment.SpInfra2ErpWS}`; // SpInfra2ErpWS
|
|
2330
|
+
this._HTTP_HEADERS = new HttpHeaders().set('Content-Type', 'application/json');
|
|
2331
|
+
this._BASE_URL = !this._customEnvironment.production ? this._BASE_URL : `${this._customEnvironment.SpInfra2ErpWS}`;
|
|
2332
|
+
}
|
|
2333
|
+
// #region ==========> API <==========
|
|
2334
|
+
// #region GET
|
|
2335
|
+
getEstabelecimentoSession(estabID) {
|
|
2336
|
+
const params = new HttpParams().set('id', estabID);
|
|
2337
|
+
const url = `${this._BASE_URL}/InfraEstabelecimento/GetEstabelecimentoSession`;
|
|
2338
|
+
return this._http.get(url, { 'params': params, 'headers': this._HTTP_HEADERS })
|
|
2339
|
+
.pipe(take(1), tap(response => {
|
|
2340
|
+
if (response.Error) {
|
|
2341
|
+
throw Error(response.ErrorMessage);
|
|
2342
|
+
}
|
|
2343
|
+
}));
|
|
2344
|
+
}
|
|
2345
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LoginOSUtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
2346
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LoginOSUtilsService, providedIn: 'root' }); }
|
|
2347
|
+
}
|
|
2348
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LoginOSUtilsService, decorators: [{
|
|
2349
|
+
type: Injectable,
|
|
2350
|
+
args: [{
|
|
2351
|
+
providedIn: 'root'
|
|
2352
|
+
}]
|
|
2353
|
+
}], ctorParameters: () => [] });
|
|
2354
|
+
|
|
2321
2355
|
class LoginOSComponent {
|
|
2322
2356
|
// #endregion PUBLIC
|
|
2323
2357
|
// #endregion ==========> PROPERTIES <==========
|
|
@@ -2329,6 +2363,9 @@ class LoginOSComponent {
|
|
|
2329
2363
|
this._router = _router;
|
|
2330
2364
|
this._storageService = _storageService;
|
|
2331
2365
|
this._messageService = _messageService;
|
|
2366
|
+
// #region ==========> PROPERTIES <==========
|
|
2367
|
+
// #region PRIVATE
|
|
2368
|
+
this._loginOSUtils = inject(LoginOSUtilsService);
|
|
2332
2369
|
// #endregion PRIVATE
|
|
2333
2370
|
// #region PUBLIC
|
|
2334
2371
|
this.loginStatus = "loading";
|
|
@@ -2354,11 +2391,27 @@ class LoginOSComponent {
|
|
|
2354
2391
|
const currUsuario = this._storageService.user ?? undefined;
|
|
2355
2392
|
this._authService.getAuthentication(this._loginOSModel.dominio).subscribe({
|
|
2356
2393
|
next: () => {
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2394
|
+
// Ignorar este trecho por agora, sempre realizar o login como se fosse novo, pois o logout atual está causando problemas de redirecionamento e perda de sessão.
|
|
2395
|
+
// if (currDominio === this._loginOSModel!.dominio && currUsuario === this._loginOSModel!.usuario) {
|
|
2396
|
+
// // VALIDAR ÚLTIMO ESTAB LOGADO
|
|
2397
|
+
// this._loginOSUtils.getEstabelecimentoSession('').subscribe({
|
|
2398
|
+
// next: res => {
|
|
2399
|
+
// // Atualiza os dados do estabelecimento na sessão
|
|
2400
|
+
// this._storageService.infraEstabId = res.InfraEstabId;
|
|
2401
|
+
// this._storageService.infraEstabNome = res.InfraEstabNome;
|
|
2402
|
+
// this._storageService.infraEmpresaId = res.InfraEmpresaId;
|
|
2403
|
+
// this._storageService.infraEmpresaNome = res.InfraEmpresaNome;
|
|
2404
|
+
// // Após, redireciona para a URL de destino
|
|
2405
|
+
// status = "keep";
|
|
2406
|
+
// this.redirect();
|
|
2407
|
+
// return;
|
|
2408
|
+
// },
|
|
2409
|
+
// error: error => {
|
|
2410
|
+
// this.loginStatus = "error";
|
|
2411
|
+
// this._authUtilService.showHTTPErrorOS(error);
|
|
2412
|
+
// }
|
|
2413
|
+
// })
|
|
2414
|
+
// }
|
|
2362
2415
|
status = (!currDominio || !currUsuario) ? "none" : "updated";
|
|
2363
2416
|
this._authService.loginOS(this._parmsLogin, this._loginOSModel.serialV6).subscribe({
|
|
2364
2417
|
next: () => {
|
|
@@ -3663,6 +3716,8 @@ class MenuLateralComponent {
|
|
|
3663
3716
|
this._menuServices.getEstabelecimentoSession(estabID).subscribe({
|
|
3664
3717
|
next: response => {
|
|
3665
3718
|
this.nomeEstabelecimento = response.InfraEstabNome;
|
|
3719
|
+
this._authStorageService.infraEstabId = response.InfraEstabId;
|
|
3720
|
+
this._authStorageService.infraEstabNome = response.InfraEstabNome;
|
|
3666
3721
|
this._authStorageService.infraEmpresaId = response.InfraEmpresaId;
|
|
3667
3722
|
this._authStorageService.infraEmpresaNome = response.InfraEmpresaNome;
|
|
3668
3723
|
},
|