fetchCampaigns()

in frontend/src/controllers/CampaignListController.es6 [12:20]


    fetchCampaigns() {
        this.campaignService.all()
            .then(campaigns => {this.$scope.campaigns = campaigns; return campaigns})
            .then(campaigns => {
                if (campaigns && campaigns.length && !this.$state.includes('allPromotions.singleCampaign')) {
                    this.$state.go('allPromotions.singleCampaign', {code: campaigns[0].code})
                }
            })
    }