浏览代码

Fix campaign start throwing error when disabling schedule on the UI.

Closes #690
Kailash Nadh 3 年之前
父节点
当前提交
251c1ea64f
共有 1 个文件被更改,包括 10 次插入6 次删除
  1. 10 6
      frontend/src/views/Campaign.vue

+ 10 - 6
frontend/src/views/Campaign.vue

@@ -406,12 +406,7 @@ export default Vue.extend({
 
 
     // Starts or schedule a campaign.
     // Starts or schedule a campaign.
     startCampaign() {
     startCampaign() {
-      let status = '';
-      if (this.canStart) {
-        status = 'running';
-      } else if (this.canSchedule) {
-        status = 'scheduled';
-      } else {
+      if (!this.canStart && !this.canSchedule) {
         return;
         return;
       }
       }
 
 
@@ -420,6 +415,15 @@ export default Vue.extend({
           // First save the campaign.
           // First save the campaign.
           this.updateCampaign().then(() => {
           this.updateCampaign().then(() => {
             // Then start/schedule it.
             // Then start/schedule it.
+            let status = '';
+            if (this.canStart) {
+              status = 'running';
+            } else if (this.canSchedule) {
+              status = 'scheduled';
+            } else {
+              return;
+            }
+
             this.$api.changeCampaignStatus(this.data.id, status).then(() => {
             this.$api.changeCampaignStatus(this.data.id, status).then(() => {
               this.$router.push({ name: 'campaigns' });
               this.$router.push({ name: 'campaigns' });
             });
             });