Ember 简单验证:'authorize' 已弃用

Ember Simple Auth: 'authorize' is deprecated

这是我的代码:

"ember-simple-auth": "^1.6.0"

"ember-cli": "^3.1.4"


export default ActiveModelAdapter.extend(DataAdapterMixin, {
  host: ENV.APP.API_HOST,  
  authorizer: 'authorizer:devise',
...

如何修复弃用警告?

我已经解决了这个问题。见 examples in the documentation.

authorize(xhr) {
    let { email, token } = this.get('session.data.authenticated');
    let authData = `Token token="${token}", email="${email}"`;
    xhr.setRequestHeader('Authorization', authData);
}

使用上面的代码代替 authorizer: 'authorizer:devise'