Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed upload links #72

Merged
merged 1 commit into from
Sep 19, 2019
Merged
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
24 changes: 12 additions & 12 deletions client/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ApolloClient from 'apollo-client';
import { WebSocketLink } from 'apollo-link-ws';
import { HttpLink } from 'apollo-link-http';
import { createHttpLink } from 'apollo-link-http';
import ApolloLink from 'apollo-link';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { getMainDefinition } from 'apollo-utilities';
Expand Down Expand Up @@ -31,27 +31,27 @@ export function initialize(config = {}) {
Object.assign(Config, config);
Object.freeze(Config);

const uploadLink = createUploadLink();

let terminatingLink;

if (!config.httpLinkOptions) {
config.httpLinkOptions = {};
}

// Backward compatibility
if (config.uri) {
config.httpLinkOptions.uri = config.uri;
} else {
// Allow GRAPHQL_ENDPOINT to be changed
config.httpLinkOptions.uri = (config.httpLinkOptions.uri) ? config.httpLinkOptions.uri : GRAPHQL_ENDPOINT;
config.httpLinkOptions.uri = config.httpLinkOptions.uri
? config.httpLinkOptions.uri
: GRAPHQL_ENDPOINT;
}

// We define the HTTP Link
const httpLink = new HttpLink({
...(config.httpLinkOptions),
});

const uploadLink = createUploadLink(config.httpLinkOptions);

// We define the HTTP Link
const httpLink = createHttpLink(config.httpLinkOptions);
console.log(config.httpLinkOptions);
if (meteorAccountsLink) {
terminatingLink = ApolloLink.concat(meteorAccountsLink, uploadLink, httpLink);
} else {
Expand All @@ -63,7 +63,7 @@ export function initialize(config = {}) {

if (!config.disableWebsockets) {
wsLink = new WebSocketLink({
uri: config.httpLinkOptions.uri.replace(/http/,'ws'),
uri: config.httpLinkOptions.uri.replace(/http/, 'ws'),
options: {
reconnect: true,
connectionParams: () => ({
Expand Down