How to use the ember-apollo-client/services/apollo.extend function in ember-apollo-client

To help you get started, we’ve selected a few ember-apollo-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Shopify / storefront-api-examples / ember-apollo / app / services / apollo.js View on Github external
import ApolloService from 'ember-apollo-client/services/apollo';

export default ApolloService.extend({
  init() {
    this._super(...arguments);
    this.get('client').networkInterface.use([{
      applyMiddleware: (req, next) => this._runAuthorize(req, next)
    }]);
  },

  _runAuthorize(req, next) {
    if (!req.options.headers) {
      req.options.headers = {}; // Create the headers object if needed.
    }
    req.options.headers['X-Shopify-Storefront-Access-Token']= 'dd4d4dc146542ba7763305d71d1b3d38';
    next();
  }
});

ember-apollo-client

An ember-cli addon for the Apollo GraphQL Client.

MIT
Latest version published 1 year ago

Package Health Score

54 / 100
Full package analysis