@trudb/tru-common-lib 0.0.356 → 0.0.358
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/lib/assets/tru-icon-module.mjs +2 -2
- package/esm2020/lib/components/login/services/tru-auth.mjs +12 -9
- package/fesm2015/trudb-tru-common-lib.mjs +11 -9
- package/fesm2015/trudb-tru-common-lib.mjs.map +1 -1
- package/fesm2020/trudb-tru-common-lib.mjs +11 -9
- package/fesm2020/trudb-tru-common-lib.mjs.map +1 -1
- package/lib/components/login/services/tru-auth.d.ts +4 -2
- package/package.json +1 -1
|
@@ -4508,17 +4508,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
|
4508
4508
|
}] });
|
|
4509
4509
|
|
|
4510
4510
|
class TruAuth {
|
|
4511
|
-
constructor(router, http, cache, auth) {
|
|
4511
|
+
constructor(router, http, cache, environment, auth) {
|
|
4512
4512
|
this.router = router;
|
|
4513
4513
|
this.http = http;
|
|
4514
4514
|
this.cache = cache;
|
|
4515
|
+
this.environment = environment;
|
|
4515
4516
|
this.auth = auth;
|
|
4516
4517
|
this.loggedIn = new BehaviorSubject(false);
|
|
4517
|
-
this.baseUrl =
|
|
4518
|
+
this.baseUrl = '';
|
|
4519
|
+
if (location.hostname === 'localhost' || location.hostname === '127.0.0.1' || location.hostname === '')
|
|
4520
|
+
this.baseUrl = 'https://localhost:44303';
|
|
4521
|
+
else
|
|
4522
|
+
this.baseUrl = '';
|
|
4518
4523
|
}
|
|
4519
4524
|
login(loginRequest) {
|
|
4520
4525
|
return this.http
|
|
4521
|
-
//.post<any>(this.baseUrl + "/auth/Login", loginRequest)
|
|
4522
4526
|
.post(`${this.baseUrl}${TRU_AUTH_CONFIG.authUrl}/login`, loginRequest)
|
|
4523
4527
|
.pipe(tap((data) => {
|
|
4524
4528
|
this.auth.doLoginUser(data);
|
|
@@ -4529,9 +4533,7 @@ class TruAuth {
|
|
|
4529
4533
|
this.doLogoutUser();
|
|
4530
4534
|
}
|
|
4531
4535
|
isLoggedIn$() {
|
|
4532
|
-
return this.auth.getCurrentUser().pipe(map(() => true),
|
|
4533
|
-
//map((user) => !!user),
|
|
4534
|
-
catchError(() => of(false)));
|
|
4536
|
+
return this.auth.getCurrentUser().pipe(map(() => true), catchError(() => of(false)));
|
|
4535
4537
|
}
|
|
4536
4538
|
get isLoggedIn() {
|
|
4537
4539
|
if (!this.loggedIn.value) {
|
|
@@ -4551,14 +4553,14 @@ class TruAuth {
|
|
|
4551
4553
|
this.auth.doLogoutUser();
|
|
4552
4554
|
}
|
|
4553
4555
|
}
|
|
4554
|
-
TruAuth.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruAuth, deps: [{ token: i1$5.Router }, { token: i1$2.HttpClient }, { token: TruAuthCache }, { token: TRU_AUTH_STRATEGY }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4556
|
+
TruAuth.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruAuth, deps: [{ token: i1$5.Router }, { token: i1$2.HttpClient }, { token: TruAuthCache }, { token: TruAppEnvironment }, { token: TRU_AUTH_STRATEGY }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
4555
4557
|
TruAuth.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruAuth, providedIn: "root" });
|
|
4556
4558
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruAuth, decorators: [{
|
|
4557
4559
|
type: Injectable,
|
|
4558
4560
|
args: [{
|
|
4559
4561
|
providedIn: "root",
|
|
4560
4562
|
}]
|
|
4561
|
-
}], ctorParameters: function () { return [{ type: i1$5.Router }, { type: i1$2.HttpClient }, { type: TruAuthCache }, { type: undefined, decorators: [{
|
|
4563
|
+
}], ctorParameters: function () { return [{ type: i1$5.Router }, { type: i1$2.HttpClient }, { type: TruAuthCache }, { type: TruAppEnvironment }, { type: undefined, decorators: [{
|
|
4562
4564
|
type: Inject,
|
|
4563
4565
|
args: [TRU_AUTH_STRATEGY]
|
|
4564
4566
|
}] }]; } });
|
|
@@ -5538,7 +5540,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
|
5538
5540
|
}], ctorParameters: function () { return []; } });
|
|
5539
5541
|
|
|
5540
5542
|
const GO_TO_ICON = `
|
|
5541
|
-
<svg xmlns="http://www.w3.org/2000/svg" height="
|
|
5543
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="20" viewBox="0 -960 960 960" width="20"><path d="M216-144q-29.7 0-50.85-21.15Q144-186.3 144-216v-528q0-29.7 21.15-50.85Q186.3-816 216-816h264v72H216v528h528v-264h72v264q0 29.7-21.15 50.85Q773.7-144 744-144H216Zm171-192-51-51 357-357H576v-72h240v240h-72v-117L387-336Z"/></svg>
|
|
5542
5544
|
`;
|
|
5543
5545
|
class TruIconModule {
|
|
5544
5546
|
constructor(sanitizer, iconRegistry) {
|