From 1f9604827af550a3864f5b39c11ff0a17119a00b Mon Sep 17 00:00:00 2001
From: Bastien DUMONT <bdumont@grandlyon.com>
Date: Fri, 19 Aug 2022 13:55:09 +0200
Subject: [PATCH] publish: fix: isFirstStart

generated from commit 500cb668cc82fe58474d607757a5fdd7390a9c6a
---
 index.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/index.js b/index.js
index 4e297a7..60a0ce3 100644
--- a/index.js
+++ b/index.js
@@ -165,6 +165,7 @@ async function start(fields, cozyParameters) {
       consent,
       serviceId.toString()
     )
+    console.log(consent)
     // Save bo id into account
     const accountData = await getAccount(ACCOUNT_ID)
 
@@ -228237,8 +228238,13 @@ async function verifyContract(url, apiAuthKey, appLogin, contractId, pointId) {
   })
 
   try {
+    log('debug', parsedReply)
+    if (!parsedReply) {
+      return null
+    }
     const currentContracts = parseContracts(parsedReply)
     let currentContract = null
+    // log('debug', 'current contract size length', currentContracts.length)
     if (Array.isArray(currentContracts)) {
       currentContract = parseContracts(parsedReply)[0]
     } else {
-- 
GitLab