Browse Source

fix: add account data update permission + handle async saveAccountData

master
doubleface 11 months ago
parent
commit
36ae448cb2
2 changed files with 3 additions and 6 deletions
  1. +1
    -4
      manifest.konnector
  2. +2
    -2
      src/index.js

+ 1
- 4
manifest.konnector View File

@@ -46,10 +46,7 @@
"type": "io.cozy.files"
},
"accounts": {
"type": "io.cozy.accounts",
"verbs": [
"GET"
]
"type": "io.cozy.accounts"
}
},
"developer": {

+ 2
- 2
src/index.js View File

@@ -165,7 +165,7 @@ async function getList(params, urlPart, subItem, splitPart) {
/* Function that retrieve all new declaration not sync before */
async function getAllDeclaration(params, declarationList) {
let accData = this.getAccountData()
let exist = Object.keys(accData).length > 0
let exist = Object.keys(accData).includes('lastSaved')
let bills = []
let lastPeriod = declarationList.length - 1
if (exist) {
@@ -177,7 +177,7 @@ async function getAllDeclaration(params, declarationList) {
const bill = await getDeclaration(params, declarationList[i])
bills.push(bill)
accData.lastSaved = declarationList[i]
this.saveAccountData(accData, { merge: false })
await this.saveAccountData(accData, { merge: false })
} catch (error) {
log('error', error)
break

Loading…
Cancel
Save