diff --git a/src/store/modules/job/actions.ts b/src/store/modules/job/actions.ts index c0225028..1822662d 100644 --- a/src/store/modules/job/actions.ts +++ b/src/store/modules/job/actions.ts @@ -759,6 +759,11 @@ const actions: ActionTree = { return payload?.job; } + if(!payload.jobId) { + commit(types.JOB_CURRENT_UPDATED, {}); + return; + } + let currentJob = pendingJobs.find((job: any) => job.jobId === payload.jobId); currentJob = currentJob ? currentJob : cachedJobs[payload?.jobId]; diff --git a/src/views/Brokering.vue b/src/views/Brokering.vue index 1f8149b7..739c1814 100644 --- a/src/views/Brokering.vue +++ b/src/views/Brokering.vue @@ -222,7 +222,14 @@ export default defineComponent({ this.currentJob.runTime = '' } - await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob }); + const job = await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob, jobId: this.jobEnums[jobInformation.id] }); + if(job) { + this.currentJob = job + } else { + showToast(translate('Configuration missing')) + return; + } + if(!this.isDesktop && this.currentJob) { this.router.push({ name: 'JobDetails', params: { jobId: this.currentJob.jobId, category: "orders" } }); return; diff --git a/src/views/Fulfillment.vue b/src/views/Fulfillment.vue index b18b7fed..5bbf32a0 100644 --- a/src/views/Fulfillment.vue +++ b/src/views/Fulfillment.vue @@ -249,7 +249,14 @@ export default defineComponent({ this.currentJob.runTime = '' } - await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob }); + const job = await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob, jobId: this.jobEnums[jobInformation.id] }); + if(job) { + this.currentJob = job + } else { + showToast(translate('Configuration missing')) + return; + } + if(!this.isDesktop && this.currentJob) { this.router.push({ name: 'JobDetails', params: { jobId: this.currentJob.jobId, category: "orders" } }); return; diff --git a/src/views/InitialLoad.vue b/src/views/InitialLoad.vue index 11b035e9..c8934cb6 100644 --- a/src/views/InitialLoad.vue +++ b/src/views/InitialLoad.vue @@ -179,11 +179,6 @@ export default defineComponent({ this.currentSelectedJobModal = label; this.job = this.getJob(id); - if (!this.job) { - showToast(translate('Configuration missing')) - return; - } - if(this.job?.runtimeData?.sinceId?.length >= 0) { this.lastShopifyOrderId = this.job.runtimeData.sinceId !== 'null' ? this.job.runtimeData.sinceId : '' } @@ -192,7 +187,14 @@ export default defineComponent({ this.job.runTime = '' } - await this.store.dispatch('job/updateCurrentJob', { job: this.job }); + const job = await this.store.dispatch('job/updateCurrentJob', { job: this.job, jobId: id }); + if(job) { + this.job = job + } else { + showToast(translate('Configuration missing')) + return; + } + if(!this.isDesktop && this.job) { this.router.push({ name: 'JobDetails', params: { jobId: this.job.jobId, category: "initial-load" } }); return; diff --git a/src/views/Inventory.vue b/src/views/Inventory.vue index 869b23af..16c76f30 100644 --- a/src/views/Inventory.vue +++ b/src/views/Inventory.vue @@ -185,7 +185,14 @@ export default defineComponent({ this.currentJobStatus = jobInformation.status; this.freqType = jobInformation.id && this.jobFrequencyType[jobInformation.id] - await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob }); + const job = await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob, jobId: this.jobEnums[jobInformation.id] }); + if(job) { + this.currentJob = job + } else { + showToast(translate('Configuration missing')) + return; + } + if(!this.isDesktop && this.currentJob) { this.router.push({ name: 'JobDetails', params: { jobId: this.currentJob.jobId, category: "inventory" } }); return; diff --git a/src/views/Orders.vue b/src/views/Orders.vue index 8b15633e..f5435858 100644 --- a/src/views/Orders.vue +++ b/src/views/Orders.vue @@ -241,7 +241,14 @@ export default defineComponent({ this.currentJob.runTime = '' } - await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob }); + const job = await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob, jobId: this.jobEnums[jobInformation.id] }); + if(job) { + this.currentJob = job + } else { + showToast(translate('Configuration missing')) + return; + } + if(!this.isDesktop && this.currentJob) { this.router.push({ name: 'JobDetails', params: { jobId: this.currentJob.jobId, category: "orders" } }); return; diff --git a/src/views/PreOrder.vue b/src/views/PreOrder.vue index 143bf586..2df13b47 100644 --- a/src/views/PreOrder.vue +++ b/src/views/PreOrder.vue @@ -316,7 +316,14 @@ export default defineComponent({ this.currentJobStatus = jobInformation.status; this.freqType = jobInformation.id && this.jobFrequencyType[jobInformation.id] - await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob }); + const job = await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob, jobId: this.jobEnums[jobInformation.id] }); + if(job) { + this.currentJob = job + } else { + showToast(translate('Configuration missing')) + return; + } + if(!this.isDesktop) { this.router.push({ name: 'JobDetails', params: { jobId: this.currentJob.jobId, category: "pre-order" } }); return; diff --git a/src/views/Product.vue b/src/views/Product.vue index 0de88db8..01358e12 100644 --- a/src/views/Product.vue +++ b/src/views/Product.vue @@ -70,11 +70,12 @@ import { import { defineComponent } from 'vue'; import { mapGetters, useStore } from 'vuex'; import JobConfiguration from '@/components/JobConfiguration.vue' -import { isFutureDate } from '@/utils'; +import { isFutureDate, showToast } from '@/utils'; import emitter from '@/event-bus'; import { useRouter } from 'vue-router' import MoreJobs from '@/components/MoreJobs.vue' import { Actions, hasPermission } from '@/authorization' +import { translate } from '@/i18n'; export default defineComponent({ name: 'Product', @@ -157,7 +158,14 @@ export default defineComponent({ this.currentJobStatus = jobInformation.status; this.freqType = jobInformation.id && this.jobFrequencyType[jobInformation.id] - await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob }); + const job = await this.store.dispatch('job/updateCurrentJob', { job: this.currentJob, jobId: this.jobEnums[jobInformation.id] }); + if(job) { + this.currentJob = job + } else { + showToast(translate('Configuration missing')) + return; + } + if(!this.isDesktop && this.currentJob) { this.router.push({ name: 'JobDetails', params: { jobId: this.currentJob.jobId, category: "product" } }); return;