Skip to content

Commit

Permalink
AAE-20808 Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan-2019 committed Dec 5, 2024
1 parent 61783f1 commit 1fcf092
Showing 1 changed file with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import { createClient } from 'graphql-ws';
import { Inject, Injectable, Optional } from '@angular/core';
import { inject, Inject, Injectable, Optional } from '@angular/core';
import { GraphQLWsLink } from '@apollo/client/link/subscriptions';
import { WebSocketLink } from '@apollo/client/link/ws';
import {
Expand Down Expand Up @@ -52,6 +52,7 @@ interface serviceOptions {
providedIn: 'root'
})
export class WebSocketService {
private appConfigService = inject(AppConfigService);
private host = '';
private subscriptionProtocol: 'graphql-ws' | 'transport-ws' = 'transport-ws';
private wsLink: GraphQLWsLink | WebSocketLink;
Expand All @@ -60,7 +61,6 @@ export class WebSocketService {
constructor(
private readonly apollo: Apollo,
private readonly httpLink: HttpLink,
private readonly appConfigService: AppConfigService,
private readonly authService: AuthenticationService,
@Optional() @Inject(FeaturesServiceToken) private featuresService: IFeaturesService
) {
Expand Down Expand Up @@ -171,12 +171,7 @@ export class WebSocketService {
...(this.subscriptionProtocol === 'transport-ws' && { 'X-Authorization': `Bearer ${this.authService.getToken()}` })
},
link: from([authLink, retryLink, errorLink, link]),
cache: new InMemoryCache({ merge: true } as InMemoryCacheConfig),
defaultOptions: {
watchQuery: {
errorPolicy: 'all'
}
}
cache: new InMemoryCache({ merge: true } as InMemoryCacheConfig)
});
}

Expand Down

0 comments on commit 1fcf092

Please sign in to comment.