diff --git a/src/requests/cozy.js b/src/requests/cozy.js index 43ab428a916a2132480e9d9062125a88b17db19e..99b25b70d3d3ecbd51575eb9398b4e69f7b76468 100644 --- a/src/requests/cozy.js +++ b/src/requests/cozy.js @@ -14,10 +14,15 @@ async function saveAccountData(accountId, accountData) { return account } -async function getAccount(accountId) { +async function getAccount(accountId, accountRev) { log('info', `getAccount: ${accountId}`) const accounts = await cozyClient.data.findAll('io.cozy.accounts') - log('info', `getAccount: ${JSON.stringify(accounts)}`) + const body = await cozyClient.fetchJSON( + 'GET', + `/data/io.cozy.accounts/${accountId}?rev=${accountRev}` + ) + + log('info', `getAccount: ${body}`) return accounts.filter(account => isLocal() ? account._id === accountId : account.account_type === accountId )[0]