@sumaris-net/ngx-components 2.0.6 → 2.0.7

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.
@@ -15553,6 +15553,7 @@ class GraphqlService extends StartableService {
15553
15553
  this.connectionParams = {};
15554
15554
  this.onNetworkError = new Subject();
15555
15555
  this.customErrors = {};
15556
+ this.onResetAuth = new Subject();
15556
15557
  this._debug = !environment.production;
15557
15558
  this._defaultFetchPolicy = environment.apolloFetchPolicy;
15558
15559
  // Listen network status
@@ -15581,13 +15582,7 @@ class GraphqlService extends StartableService {
15581
15582
  else if (this.connectionParams.authToken) {
15582
15583
  console.debug('[graphql] Remove token authentication from headers');
15583
15584
  delete this.connectionParams.authToken;
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
- }
15585
+ await this.clearCache();
15591
15586
  }
15592
15587
  }
15593
15588
  async setAuthBasic(basic) {
@@ -15599,13 +15594,7 @@ class GraphqlService extends StartableService {
15599
15594
  else if (this.connectionParams.authBasic) {
15600
15595
  console.debug('[graphql] Remove basic authentication from headers');
15601
15596
  delete this.connectionParams.authBasic;
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
- }
15597
+ await this.clearCache();
15609
15598
  }
15610
15599
  }
15611
15600
  /**
@@ -16015,9 +16004,15 @@ class GraphqlService extends StartableService {
16015
16004
  const storage = new StorageServiceWrapper(this.storage);
16016
16005
  let client = this.apollo.client;
16017
16006
  if (!client) {
16018
- console.debug('[apollo] Creating GraphQL client...');
16007
+ console.debug('[graphql] Creating Apollo GraphQL client...');
16019
16008
  // Websocket link
16020
16009
  const wsLink = new GraphQLWsLink(createClient(this.wsParams));
16010
+ this.onResetAuth
16011
+ .pipe(takeUntil(this.stopSubject))
16012
+ .subscribe(() => {
16013
+ console.info('[graphql] Closing websocket client, to force unauth');
16014
+ wsLink.client.dispose();
16015
+ });
16021
16016
  // Retry when failed link
16022
16017
  const retryLink = new RetryLink();
16023
16018
  const authLink = new ApolloLink((operation, forward) => {