From 27348e2b63fa1ce00d23d9dd5af4bf888e3ac52c Mon Sep 17 00:00:00 2001
From: build-token <build-token>
Date: Fri, 29 Mar 2024 08:40:21 +0000
Subject: [PATCH] publish: chore: fix standalone

generated from commit 09c6ef54ffa15bebfccbcdc03e7f6f999eac99cb
---
 index.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/index.js b/index.js
index ff36782..f5cf5d6 100644
--- a/index.js
+++ b/index.js
@@ -13,7 +13,7 @@ const {
   log
 } = __webpack_require__(1)
 const getDataGenericErrors = __webpack_require__(1465)
-const { isDev } = __webpack_require__(1466)
+const { isDev, isLocal } = __webpack_require__(1466)
 const moment = __webpack_require__(1467)
 __webpack_require__(1604)
 moment.locale('fr') // set the language
@@ -54,7 +54,7 @@ const manualExecution = process.env.COZY_JOB_MANUAL_EXECUTION === 'true'
 const startDate = moment().subtract(manualExecution ? 1 : 3, 'year')
 const endDate = moment().startOf('day')
 
-const ACCOUNT_ID = 'grdfgrandlyon'
+const ACCOUNT_ID = isLocal() ? 'default_account_id' : 'grdfgrandlyon'
 
 module.exports = new BaseKonnector(start)
 
@@ -94,7 +94,7 @@ async function handleConsents(consents, boBaseUrl, boToken) {
   if (consents.some(consent => consent.etat_droit_acces === 'Refusée')) {
     log('info', 'Found consent "Refusée"')
     const accountData = await getAccount(ACCOUNT_ID)
-    if (accountData.data.consentId) {
+    if (accountData?.data?.consentId) {
       await deleteBoConsent({
         boBaseUrl,
         boToken,
-- 
GitLab