diff --git a/modules/worker/front/calendar/index.js b/modules/worker/front/calendar/index.js index d60fa0647..014a35b63 100644 --- a/modules/worker/front/calendar/index.js +++ b/modules/worker/front/calendar/index.js @@ -91,8 +91,10 @@ class Controller extends Section { } getActiveContract() { - this.$http.get(`Workers/${this.worker.id}/activeContract`) - .then(res => this.businessId = res.data.businessFk); + this.$http.get(`Workers/${this.worker.id}/activeContract`).then(res => { + if (res.data) + this.businessId = res.data.businessFk; + }); } getContractHolidays() { diff --git a/modules/worker/front/time-control/index.js b/modules/worker/front/time-control/index.js index b980243c9..2631c82d2 100644 --- a/modules/worker/front/time-control/index.js +++ b/modules/worker/front/time-control/index.js @@ -90,7 +90,10 @@ class Controller extends Section { getActiveContract() { return this.$http.get(`Workers/${this.worker.id}/activeContract`) - .then(res => this.businessId = res.data.businessFk); + .then(res => { + if (res.data) + this.businessId = res.data.businessFk; + }); } fetchHours() { @@ -111,6 +114,8 @@ class Controller extends Section { } getAbsences() { + if (!this.businessId) return; + const fullYear = this.started.getFullYear(); let params = { businessFk: this.businessId,