Skip to content

Commit 2a473b9

Browse files
authored
Merge pull request #311 from evoactivity/remove-use-of-assign-polyfill
Remove use of assign polyfill
2 parents 275e692 + 64eae90 commit 2a473b9

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

addon/authenticators/jwt.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import EmberObject, { get } from '@ember/object';
44
import { getOwner } from '@ember/application';
5-
import { assign } from '@ember/polyfills';
65
import { Promise, resolve } from 'rsvp';
76
import { isEmpty } from '@ember/utils';
87
import { cancel, later } from '@ember/runloop';
@@ -134,7 +133,7 @@ export default TokenAuthenticator.extend({
134133
@return {Promise} Promise that resolves when an auth token is successfully acquired from the server and rejects otherwise
135134
*/
136135
authenticate(credentials, headers) {
137-
return this.makeRequest(this.serverTokenEndpoint, credentials, assign({}, this.headers, headers)).then(response => {
136+
return this.makeRequest(this.serverTokenEndpoint, credentials, {...this.headers, ...headers}).then(response => {
138137
return this.handleAuthResponse(response.json);
139138
});
140139
},
@@ -293,7 +292,7 @@ export default TokenAuthenticator.extend({
293292
this.scheduleAccessTokenRefresh(expiresAt, refreshToken);
294293
}
295294

296-
return assign(response, tokenExpireData, {tokenData: tokenData});
295+
return {...response, ...tokenExpireData, tokenData: tokenData};
297296
},
298297

299298
/**

addon/authenticators/token.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import EmberObject from '@ember/object';
22
import { getOwner } from '@ember/application';
33
import fetch from 'fetch';
4-
import { assign } from '@ember/polyfills';
54
import { Promise, reject, resolve } from 'rsvp';
65
import { isEmpty } from '@ember/utils';
76
import Base from 'ember-simple-auth/authenticators/base';
@@ -58,7 +57,7 @@ export default Base.extend({
5857
@return {Promise} Promise that resolves when an auth token is successfully acquired from the server and rejects otherwise
5958
*/
6059
authenticate(credentials, headers) {
61-
return this.makeRequest(this.serverTokenEndpoint, credentials, assign({}, this.headers, headers)).then(response => {
60+
return this.makeRequest(this.serverTokenEndpoint, credentials, {...this.headers, ...headers}).then(response => {
6261
return response.json;
6362
});
6463
},
@@ -83,10 +82,11 @@ export default Base.extend({
8382
makeRequest(url, data, headers) {
8483
return fetch(url, {
8584
method: 'POST',
86-
headers: assign({
85+
headers: {
8786
'Accept': 'application/json',
88-
'Content-Type': 'application/json'
89-
}, headers),
87+
'Content-Type': 'application/json',
88+
...headers
89+
},
9090
body: JSON.stringify(data)
9191
}).then(response => {
9292
const res = {

0 commit comments

Comments
 (0)