我正在尝试在商店内存储一些登录后的数据。下面是我的 torii 适配器的代码
import Ember from 'ember';
import {createToken} from 'myapp/utils/app-utils';
export default Ember.Object.extend({
store: Ember.inject.service(),
open: function(authentication){
let authorizationCode = authentication.authorizationCode;
let token = createToken();
return new Ember.RSVP.Promise(function(resolve, reject){
console.log(authentication);
Ember.$.ajax({
url: 'http://localhost/getUserInfoWuthAuthCode.php',
data: { 'code': authorizationCode,token:token},
success: Ember.run.bind(null, resolve),
error: Ember.run.bind(null, reject)
});
}).then(function(data){
let user = data.user[0];
this.set('storage.token',token); //this is undefined
return {
user: user
};
});
}
});
我得到的错误是“TypeError:无法读取未定义的属性'set'”。我也在注入商店服务。你能告诉我这里到底出了什么问题吗?