function _default(passedOptions) { var options = _objectSpread(_objectSpread({}, defaultOptions), passedOptions); (0, _options.setOptions)(options); var link = (0, _createLink["default"])(options); var client = new _apolloClient.ApolloClient({ link: link, cache: options.cache, resolvers: options.resolvers }); global.apolloClient = client; options.apolloClient = client; (0, _options.setOptions)(options); return client; }
var getClient = function getClient(_ref) { var client = _ref.client, clientOptions = _ref.clientOptions; if (client) return client; if (clientOptions) { var networkInterface = clientOptions.networkInterface, uri = clientOptions.uri, options = (0, _objectWithoutProperties3.default)(clientOptions, ['networkInterface', 'uri']); if (networkInterface) { if (networkInterface && uri) { console.error('Warning: You specified a networkInterface and an uri option. uri will be ignored.'); } return new _apolloClient.ApolloClient((0, _extends3.default)({}, options, { networkInterface: networkInterface })); } if (!networkInterface && uri) { options.networkInterface = (0, _apolloClient.createNetworkInterface)({ uri: uri }); } return new _apolloClient.ApolloClient(options); } return new _apolloClient.ApolloClient(); }