in the course of learning "Es6 Lottery Project", I encountered a Uncaught (in promise) error
error pointing to this.getState (). Then. This sentence, moreover, get/state reported 404
interface.js
/**
*
* @param {string} issue []
* @return {[type]} [description]
*/
getState(issue){
let self = this;
return new Promise((resolve, reject) => {
$.ajax({
url:"/get/state",
data:{
issue:issue
},
dataType:"json",
success:function(res){
resolve.call(self,res);
},
error:function(err){
reject.call(err);
}
})
})
}
}
lottery.js
/**
* [updateState ]
* @return {[type]} [description]
*/
updateState(){
let self=this;
this.getState().then(function(res){
self.issue=res.issue;
self.end_time=res.end_time;
self.state=res.state;
$(self.issue_el).text(res.issue);
self.countdown(res.end_time,function(time){
$(self.countdown_el).html(time)
},function(){
setTimeout(function () {
self.updateState();
self.getOmit(self.issue).then(function(res){
});
self.getOpenCode(self.issue).then(function(res){
});
}, 500);
})
})
}
Please give me some advice if you know why. Thank you.