Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
igorT committed Feb 3, 2021
1 parent 3343cef commit 64f6959
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
11 changes: 9 additions & 2 deletions packages/adapter/addon/json-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { dasherize } from '@ember/string';
import { pluralize } from 'ember-inflector';

import { serializeIntoHash } from './-private';
import RESTAdapter, {FetchRequestInit, JQueryRequestInit} from './rest';
import RESTAdapter from './rest';

type FetchRequestInit = import('./rest').FetchRequestInit;
type JQueryRequestInit = import('./rest').JQueryRequestInit;

type Dict<T> = import('@ember-data/store/-private/ts-interfaces/utils').Dict<T>;
type ShimModelClass = import('@ember-data/store/-private/system/model/shim-model-class').default;
Expand Down Expand Up @@ -161,7 +164,11 @@ class JSONAPIAdapter extends RESTAdapter {
@param {Object} options
@return {Object}
*/
ajaxOptions(url: string, type: string, options: JQueryAjaxSettings | RequestInit = {}): JQueryRequestInit | FetchRequestInit {
ajaxOptions(
url: string,
type: string,
options: JQueryAjaxSettings | RequestInit = {}
): JQueryRequestInit | FetchRequestInit {
let hash = super.ajaxOptions(url, type, options);

hash.headers['Accept'] = hash.headers['Accept'] || 'application/vnd.api+json';
Expand Down
13 changes: 6 additions & 7 deletions packages/adapter/addon/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1121,7 +1121,11 @@ class RESTAdapter extends Adapter.extend(BuildURLMixin) {
@param {Object} options
@return {Object}
*/
ajaxOptions(url: string, method: string, options: JQueryAjaxSettings | RequestInit): JQueryRequestInit | FetchRequestInit {
ajaxOptions(
url: string,
method: string,
options: JQueryAjaxSettings | RequestInit
): JQueryRequestInit | FetchRequestInit {
let reqOptions: JQueryRequestInit | FetchRequestInit = assign(
{
url,
Expand Down Expand Up @@ -1387,12 +1391,7 @@ function ajaxSuccessHandler(
return ajaxSuccess(adapter, payload, requestData, responseData);
}

function ajaxErrorHandler(
adapter: RESTAdapter,
jqXHR: JQuery.jqXHR,
errorThrown: string,
requestData: RequestData
) {
function ajaxErrorHandler(adapter: RESTAdapter, jqXHR: JQuery.jqXHR, errorThrown: string, requestData: RequestData) {
let responseData = ajaxResponseData(jqXHR);
responseData.errorThrown = errorThrown;
let payload = adapter.parseErrorResponse(jqXHR.responseText);
Expand Down

0 comments on commit 64f6959

Please sign in to comment.