How to use the @ember-data/adapter/json-api.extend function in @ember-data/adapter

To help you get started, we’ve selected a few @ember-data/adapter 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 puzzle / cryptopus / frontend / app / adapters / application.js View on Github external
import JSONAPIAdapter from "@ember-data/adapter/json-api";
import { computed } from "@ember/object";
import { pluralize } from "ember-inflector";
import { underscore } from "@ember/string";
import ENV from "../config/environment";

export default JSONAPIAdapter.extend({
  namespace: "api",

  pathForType(type) {
    return pluralize(underscore(type));
  },

  headers: computed(function () {
    /* eslint-disable no-undef  */
    return {
      "X-CSRF-Token": ENV.CSRFToken,
      "content-type": "application/json"
    };
    /* eslint-enable no-undef  */
  })
});
github CodingItWrong / firehose-api / frontend / app / adapters / application.js View on Github external
'session.{isAuthenticated,data.authenticated.access_token}',
    function () {
      const headers = {};
      if (this.session.isAuthenticated) {
        headers.Authorization = `Bearer ${this.session.data.authenticated.access_token}`;
      }
      return headers;
    },
  ),
};

if (ENV.apiHost) {
  options.host = ENV.apiHost;
}

export default JSONAPIAdapter.extend(DataAdapterMixin, options);