Skip to content
Snippets Groups Projects

Dev

Merged Hugo SUBTIL requested to merge dev into main
1 file
+ 19
1
Compare changes
  • Side-by-side
  • Inline
+ 19
1
@@ -6,11 +6,28 @@ async function saveAccountData(accountId, accountData) {
log('info', `saveAccountData: ${accountId}`)
let account = await getAccount(accountId)
log('info', `saveAccountData account: ${JSON.stringify(account)}`)
log(
'info',
`saveAccountData account: ${JSON.stringify({
...account,
data: accountData,
})}`
)
log(
'info',
`saveAccountData account after id: ${JSON.stringify({
...account,
data: accountData,
})}`
)
account = await updateOrCreate(
[{ ...account, data: accountData }],
'io.cozy.accounts'
'io.cozy.accounts',
['account_type']
)
log('info', `saveAccountData account reply: ${JSON.stringify(account)}`)
return account
}
@@ -22,6 +39,7 @@ async function saveAccountData(accountId, accountData) {
async function getAccount(accountId) {
log('info', `getAccount: ${accountId}`)
const accounts = await cozyClient.data.findAll('io.cozy.accounts')
log('info', `getAccount data: ${JSON.stringify(accounts)}`)
return accounts.filter(account =>
isLocal() ? account._id === accountId : account.account_type === accountId
)[0]
Loading