download(params = null) {
let requestPath = params ? 'campaigns?'+params : 'campaigns'
return api.request(requestPath)
.then((data) =>
this.data = data.map(row => new Campaign(row))
)
}
filteringCampaigns() {
return this.data.filter(
(campaign) => this.filterRow(campaign)
)
}
filterCampaigns(data = []) {
return data.filter(
(campaign) => this.filterRow(campaign) && availableCampaignTypes.includes(campaign.type)
)
}
...
const source = data.map(row => new Campaign(row));
this.data = this.filterCampaigns(source);