@sumaris-net/ngx-components 2.0.5 → 2.0.6

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.
@@ -15572,7 +15572,7 @@ class GraphqlService extends StartableService {
15572
15572
  get defaultFetchPolicy() {
15573
15573
  return this._defaultFetchPolicy;
15574
15574
  }
15575
- setAuthToken(token) {
15575
+ async setAuthToken(token) {
15576
15576
  if (token) {
15577
15577
  console.debug('[graphql] Apply token authentication to headers');
15578
15578
  this.connectionParams.authToken = token;
@@ -15581,11 +15581,16 @@ class GraphqlService extends StartableService {
15581
15581
  else if (this.connectionParams.authToken) {
15582
15582
  console.debug('[graphql] Remove token authentication from headers');
15583
15583
  delete this.connectionParams.authToken;
15584
- // Clear cache
15585
- this.clearCache();
15584
+ // Restart, to force client re-creation, and websocket to logout
15585
+ if (this.started) {
15586
+ await this.restart();
15587
+ }
15588
+ else {
15589
+ await this.clearCache();
15590
+ }
15586
15591
  }
15587
15592
  }
15588
- setAuthBasic(basic) {
15593
+ async setAuthBasic(basic) {
15589
15594
  if (basic) {
15590
15595
  console.debug('[graphql] Apply basic authentication to headers');
15591
15596
  this.connectionParams.authBasic = basic;
@@ -15594,8 +15599,13 @@ class GraphqlService extends StartableService {
15594
15599
  else if (this.connectionParams.authBasic) {
15595
15600
  console.debug('[graphql] Remove basic authentication from headers');
15596
15601
  delete this.connectionParams.authBasic;
15597
- // Clear cache
15598
- this.clearCache();
15602
+ // Restart, to force client re-creation, and websocket to logout
15603
+ if (this.started) {
15604
+ await this.restart();
15605
+ }
15606
+ else {
15607
+ await this.clearCache();
15608
+ }
15599
15609
  }
15600
15610
  }
15601
15611
  /**