fix: add account data update permission + handle async saveAccountData
Cette révision appartient à :
Parent
f61ecb8ce2
révision
36ae448cb2
|
@ -46,10 +46,7 @@
|
|||
"type": "io.cozy.files"
|
||||
},
|
||||
"accounts": {
|
||||
"type": "io.cozy.accounts",
|
||||
"verbs": [
|
||||
"GET"
|
||||
]
|
||||
"type": "io.cozy.accounts"
|
||||
}
|
||||
},
|
||||
"developer": {
|
||||
|
|
|
@ -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
|
||||
|
|
Chargement…
Référencer dans un nouveau ticket