【发布时间】:2018-08-12 20:21:35
【问题描述】:
getToken() {
let res={};
let token = this.cookiesServices.getCookie("mobilecookie");
if(token){
res.token=token;
console.log("token-res",res);
return res;
}else{
return new this.httpUtils.POST(`${this.apiUrl2}authorization/token`);
}
getStoresCategories(mallId) { const res = this.getToken();
const defferd = this.$q.defer();
return res.then(dta => {
const { token } = dta;
const url = `${this.apiUrl2}stores/mall/${mallId}`;
const conf = {
headers: {
Authorization: `bearer ${token}`,
"Content-Type": "application/json",
"Access-Control-Allow-Origin": "*"
}
};
this.$http.get(url, conf).then(rsp => {
defferd.resolve(rsp.data.data);
});
return defferd.promise;
});
}
缓存错误 TypeError: res.then 不是函数
【问题讨论】: