Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
fix: resolve ember-polyfills.deprecate-assign deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
boris-petrov authored and bertdeblock committed Oct 10, 2022
1 parent 5520bdf commit 5175d40
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions addon/mixins/ajax-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import EmberError from '@ember/error';
import Mixin from '@ember/object/mixin';
import { get } from '@ember/object';
import { isEmpty } from '@ember/utils';
import { assign } from '@ember/polyfills';
import { join } from '@ember/runloop';
import { warn, runInDebug } from '@ember/debug';
import Ember from 'ember';
Expand Down Expand Up @@ -434,15 +433,15 @@ export default Mixin.create({
*/
_getFullHeadersHash(headers?: Headers): Headers {
const classHeaders = get(this, 'headers');
return assign({}, classHeaders!, headers!);
return { ...classHeaders!, ...headers! };
},

/**
* Created a normalized set of options from the per-request and
* service-level settings
*/
options(url: string, options: AJAXOptions = {}): AJAXOptions {
options = assign({}, options);
options = { ...options };
options.url = this._buildURL(url, options);
options.type = options.type || 'GET';
options.dataType = options.dataType || 'json';
Expand Down
3 changes: 1 addition & 2 deletions addon/mixins/legacy/normalize-error-response.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Mixin from '@ember/object/mixin';
import { isArray } from '@ember/array';
import { isNone } from '@ember/utils';
import { assign } from '@ember/polyfills';

import isString from '../../-private/utils/is-string';
import { Headers } from '../../-private/types';
Expand Down Expand Up @@ -83,7 +82,7 @@ export default Mixin.create({
if (isJsonApiErrorResponse(payload)) {
return payload.errors.map(function(error) {
if (isObject(error)) {
const ret = assign({}, error);
const ret = { ...error };
ret.status = `${error.status}`;
return ret;
} else {
Expand Down
5 changes: 2 additions & 3 deletions tests/helpers/start-app.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import Application from '../../app';
import config from '../../config/environment';
import { assign } from '@ember/polyfills';
import { run } from '@ember/runloop';

export default function startApp(attrs) {
let attributes = assign({}, config.APP);
let attributes = Object.assign({}, config.APP);
attributes.autoboot = true;
attributes = assign(attributes, attrs); // use defaults, but you can override;
attributes = Object.assign(attributes, attrs); // use defaults, but you can override;

return run(() => {
let application = Application.create(attributes);
Expand Down

0 comments on commit 5175d40

Please sign in to comment.