Skip to content

Commit

Permalink
Prevent loading of analytics on new campaign
Browse files Browse the repository at this point in the history
  • Loading branch information
zarathustra323 committed Jun 19, 2017
1 parent 88c9f79 commit df4e2b3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/components/campaign/-analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default Component.extend({
classNames: ['card', 'mb-3'],
campaignAnalytics: service(),

isNew: false,
campaignId: null,
form: null,
loading: false,
Expand All @@ -19,11 +20,13 @@ export default Component.extend({

actions: {
loadAnalytics() {
if (this.get('isNew')) {
return;
}
this.set('loading', true);
this.get('campaignAnalytics').retrieve(this.get('campaignId'), this.get('form.identifier'))
.then((report) => {
this.set('report', report);
console.info(report);
})
.finally(() => this.set('loading', false))
;
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/campaign/email-signup/manage.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</div>
<div class="tab-pane" id="email-signup-analytics" role="tabpanel">
{{#each campaign.forms as |form|}}
{{campaign/-analytics form=form campaignId=campaign.id}}
{{campaign/-analytics form=form campaignId=campaign.id isNew=campaign.isNew}}
{{/each}}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/campaign/gated-content/manage.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
</div>
<div class="tab-pane" id="gated-content-analytics" role="tabpanel">
{{#each campaign.forms as |form|}}
{{campaign/-analytics form=form campaignId=campaign.id}}
{{campaign/-analytics form=form campaignId=campaign.id isNew=campaign.isNew}}
{{/each}}
</div>
</div>
Expand Down

0 comments on commit df4e2b3

Please sign in to comment.