Skip to content

Commit

Permalink
Linter changes for addon, addon/adapters and addon/serializers
Browse files Browse the repository at this point in the history
  • Loading branch information
pete-the-pete committed Jan 10, 2017
1 parent 99b4b22 commit 5a742f0
Show file tree
Hide file tree
Showing 7 changed files with 209 additions and 210 deletions.
25 changes: 12 additions & 13 deletions addon/adapters/json-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ import { instrument, deprecate } from 'ember-data/-private/debug';
@namespace DS
@extends DS.RESTAdapter
*/
var JSONAPIAdapter = RESTAdapter.extend({
const JSONAPIAdapter = RESTAdapter.extend({
defaultSerializer: '-json-api',

/**
Expand Down Expand Up @@ -250,13 +250,13 @@ var JSONAPIAdapter = RESTAdapter.extend({
if (isEnabled('ds-improved-ajax') && !this._hasCustomizedAjax()) {
return this._super(...arguments);
} else {
var url = this.buildURL(type.modelName, ids, snapshots, 'findMany');
let url = this.buildURL(type.modelName, ids, snapshots, 'findMany');
return this.ajax(url, 'GET', { data: { filter: { id: ids.join(',') } } });
}
},

pathForType(modelName) {
var dasherized = Ember.String.dasherize(modelName);
let dasherized = Ember.String.dasherize(modelName);
return Ember.String.pluralize(dasherized);
},

Expand All @@ -265,13 +265,12 @@ var JSONAPIAdapter = RESTAdapter.extend({
if (isEnabled('ds-improved-ajax') && !this._hasCustomizedAjax()) {
return this._super(...arguments);
} else {
var data = {};
var serializer = store.serializerFor(type.modelName);
let data = {};
let serializer = store.serializerFor(type.modelName);

serializer.serializeIntoHash(data, type, snapshot, { includeId: true });

var id = snapshot.id;
var url = this.buildURL(type.modelName, id, snapshot, 'updateRecord');
let url = this.buildURL(type.modelName, snapshot.id, snapshot, 'updateRecord');

return this.ajax(url, 'PATCH', { data: data });
}
Expand Down Expand Up @@ -311,7 +310,7 @@ if (isEnabled('ds-improved-ajax')) {
},

dataForRequest(params) {
const { requestType, ids } = params;
let { requestType, ids } = params;

if (requestType === 'findMany') {
return {
Expand All @@ -320,9 +319,9 @@ if (isEnabled('ds-improved-ajax')) {
}

if (requestType === 'updateRecord') {
const { store, type, snapshot } = params;
const data = {};
const serializer = store.serializerFor(type.modelName);
let { store, type, snapshot } = params;
let data = {};
let serializer = store.serializerFor(type.modelName);

serializer.serializeIntoHash(data, type, snapshot, { includeId: true });

Expand All @@ -333,15 +332,15 @@ if (isEnabled('ds-improved-ajax')) {
},

headersForRequest() {
const headers = this._super(...arguments) || {};
let headers = this._super(...arguments) || {};

headers['Accept'] = 'application/vnd.api+json';

return headers;
},

_requestToJQueryAjaxHash() {
const hash = this._super(...arguments);
let hash = this._super(...arguments);

if (hash.contentType) {
hash.contentType = 'application/vnd.api+json';
Expand Down
Loading

0 comments on commit 5a742f0

Please sign in to comment.