From 09c6ef54ffa15bebfccbcdc03e7f6f999eac99cb Mon Sep 17 00:00:00 2001 From: Bastien Dumont <bdumont@grandlyon.com> Date: Fri, 29 Mar 2024 09:37:49 +0100 Subject: [PATCH] chore: fix standalone --- src/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 01e1c6d..4be61f3 100755 --- a/src/index.js +++ b/src/index.js @@ -8,7 +8,7 @@ const { log } = require('cozy-konnector-libs') const getDataGenericErrors = require('./helpers/getDataGenericErrors') -const { isDev } = require('./helpers/env') +const { isDev, isLocal } = require('./helpers/env') const moment = require('moment') require('moment-timezone') moment.locale('fr') // set the language @@ -49,7 +49,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) @@ -89,7 +89,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