@csmart/ngc-smart-core 1.13.2 → 1.13.4

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.
@@ -16,8 +16,8 @@ import * as i2$2 from '@angular/material/snack-bar';
16
16
  import { MatSnackBar } from '@angular/material/snack-bar';
17
17
  import { MatMenuModule } from '@angular/material/menu';
18
18
  import * as i1 from '@angular/common/http';
19
- import { HttpClientModule } from '@angular/common/http';
20
- import { Subject, of, from, throwError, EMPTY, concat } from 'rxjs';
19
+ import { HttpHeaders, HttpClientModule } from '@angular/common/http';
20
+ import { Subject, of, from, lastValueFrom, throwError, EMPTY, concat } from 'rxjs';
21
21
  import { map, switchMap, take, catchError, mergeMap, retryWhen, delay } from 'rxjs/operators';
22
22
  import { connectToChild } from 'penpal';
23
23
  import * as i2 from '@azure/msal-angular';
@@ -847,9 +847,12 @@ class SmartAuthService {
847
847
  }
848
848
  }
849
849
  async setSelectedOffender(selectedOffender) {
850
+ if (!this.loginStaff) {
851
+ return;
852
+ }
850
853
  if (selectedOffender) {
851
854
  // if (!selectedOffender.assignmentStaffRelationId) {
852
- const relation = await this.getStaffOffenderRelation(this.loginStaff.staffId, selectedOffender.offenderId).toPromise();
855
+ const relation = await lastValueFrom(this.getStaffOffenderRelation(this.loginStaff.staffId, selectedOffender.offenderId));
853
856
  if (relation) {
854
857
  selectedOffender.assignmentStaffRelationId = relation;
855
858
  }
@@ -1108,6 +1111,12 @@ class SmartAuthService {
1108
1111
  element.setAttribute('style', 'display: none;');
1109
1112
  }
1110
1113
  getStaff(userName) {
1114
+ const httpOptions = {
1115
+ headers: new HttpHeaders({
1116
+ 'Content-Type': 'application/json',
1117
+ 'No-Auth': 'True',
1118
+ }),
1119
+ };
1111
1120
  const queryString = `
1112
1121
  {
1113
1122
  findvStaffs(input: {where: {userName: "${userName}", activeFlag: true}}) {
@@ -1148,7 +1157,7 @@ class SmartAuthService {
1148
1157
  }
1149
1158
  }`;
1150
1159
  return this.http
1151
- .post(this.smartDataServiceUrl, { query: queryString })
1160
+ .post(this.smartDataServiceUrl, { query: queryString }, httpOptions)
1152
1161
  .pipe(take(1), map((result) => {
1153
1162
  if (isDevMode) {
1154
1163
  console.log('##### getStaff() from service ', result);
@@ -1160,12 +1169,12 @@ class SmartAuthService {
1160
1169
  return data;
1161
1170
  }
1162
1171
  else {
1163
- return null;
1172
+ return of(null);
1164
1173
  // return throwError('No access right.');
1165
1174
  }
1166
1175
  }), catchError((error) => {
1167
1176
  console.log('error ' + error);
1168
- return null;
1177
+ return of(null);
1169
1178
  }));
1170
1179
  }
1171
1180
  getStaffOffenderRelation(staffId, offenderId) {