Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/core/apollo-client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import gql from 'graphql-tag';

type ApolloClientCommon = {
uri: string;
subscriptionUri?: string;
extendLinks?: (links: ApolloLink[], options: { getAuthState?: () => IAuthState }) => ApolloLink[];
onAuthError?: (error?: {}) => void;
onIdTokenExpired?: () => Promise<any>;
Expand All @@ -36,6 +37,7 @@ type ApolloClientOptions = {
*
* @param {Object} config - The Apollo Client config.
* @param {string} config.uri Endpoint of the GraphQl server.
* @param {string} config.subscriptionUri Endpoint of the GraphQl websocket server.
* @param {Function} config.getAuthState - The function which are using to get auth state.
* @param {Function} config.getRefreshTokenParameters - The function which are using for get refresh token parameters.
* @param {Function} config.onAuthSuccess - The callback which called when attempt to refresh authentication is success.
Expand All @@ -51,6 +53,7 @@ class ApolloClient extends OriginalApolloClient<Object> {
constructor(config: ApolloClientOptions) {
const {
uri,
subscriptionUri,
getAuthState,
getRefreshTokenParameters,
onAuthSuccess,
Expand Down Expand Up @@ -85,7 +88,7 @@ class ApolloClient extends OriginalApolloClient<Object> {
return definition.kind === 'OperationDefinition' && definition.operation === 'subscription';
},
new SubscriptionLink({
uri: 'wss://ws.8base.com',
uri: subscriptionUri || 'wss://ws.8base.com',
getAuthState,
onAuthError,
onIdTokenExpired,
Expand Down