Skip to content

Commit

Permalink
Move from authorizers to authorize function (#675)
Browse files Browse the repository at this point in the history
authorizers were deprecated and removed in v2 of ember-simple-auth. This
is a pretty old version of the addon but doing these small upgrades
should help in the long run
  • Loading branch information
Tonkpils authored Oct 5, 2023
1 parent d94f17f commit 233b0c9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions frontend/app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin';
import ENV from 'flaredown/config/environment';

export default ActiveModelAdapter.extend(DataAdapterMixin, {
authorizer: 'authorizer:devise',
host: ENV.apiHost,
namespace: 'api',
coalesceFindRequests: true
coalesceFindRequests: true,
// defaults
// identificationAttributeName: 'email'
// tokenAttributeName: 'token'
authorize(xhr) {
let { email, token } = this.get('session.data.authenticated');
let authData = `Token token="${token}", email="${email}"`;
xhr.setRequestHeader('Authorization', authData);
}
});

0 comments on commit 233b0c9

Please sign in to comment.