Gostaria de uma ajuda para resolver esse erro.
Controller
class NegotiationController {
constructor() {
let $ = document.querySelector.bind(document);
this._inputDate = $('#data');
this._inputAmount = $('#quantidade');
this._inputValue = $('#valor');
let self = this;
this._currentOrder = '';
this._negotiationView = new NegotiationView($('#negotiation-view'));
this._listNegotiation = new BindHelper(new ListNegotiation(),
this._negotiationView, 'add', 'delete', 'order', 'inverseOrder');
this._messageView = new MessageView($('#message-view'));
this._message = new BindHelper(new Message(), this._messageView, 'msg');
this._util = new NegotiationUtil();
this._init();
}
_init() {
this._util
.list()
.then(negotiations => {
negotiations.forEach(negotiation => this._listNegotiation.add(negotiation))
}).catch(err => this._message.msg = err);
setInterval(() => {
this.import();
}, 3000);
}
import() {
this._util
.import(this._listNegotiation.list)
.then(negotiations => {
negotiations.forEach(negotiation => this._listNegotiation.add(negotiation));
}).catch(err => this._message.msg = err);
}
Util
class NegotiationUtil {
constructor() {
this._http = new HttpUtil();
}
negotiationsPromise() {
return Promise.all([
this._weekNegotiations(),
this._weeksAgoNegotiations(),
this._twoWeeksAgoNegotiations()
]).then(periods => periods.reduce((data, period) => data.concat(period), [])
).catch(err => {
throw new Error(err);
});
}
import(currentList) {
return this.negotiationsPromise()
.then(negotiations => {
negotiations.filter(negotiation => {
!currentList.some(negotiationExisting => {
JSON.stringify(negotiation) == JSON.stringify(negotiationExisting);
});
});
}).catch(err => {
console.log(err);
throw new Error('Access daneid');
});
}