diff --git a/src/app/domain/authentication/services/SynchronizeService.ts b/src/app/domain/authentication/services/SynchronizeService.ts index ba6aa0d2e..7d9b45f0a 100644 --- a/src/app/domain/authentication/services/SynchronizeService.ts +++ b/src/app/domain/authentication/services/SynchronizeService.ts @@ -9,6 +9,8 @@ import { saveClient } from '/libs/clientHelpers/persistClient' export const syncLog = Minilog('📱 SynchronizeService') +const SYNCHRONIZE_DELAY_IN_MS = 10 * 1000 + export const synchronizeDevice = async (client: CozyClient): Promise => { try { await client.getStackClient().fetchJSON('POST', '/settings/synchronized') @@ -50,6 +52,12 @@ export const checkClientName = async (client: CozyClient): Promise => { } export const synchronizeOnInit = async (client: CozyClient): Promise => { - await checkClientName(client) - await synchronizeDevice(client) + return new Promise(resolve => { + // eslint-disable-next-line @typescript-eslint/no-misused-promises + setTimeout(async (): Promise => { + await checkClientName(client) + await synchronizeDevice(client) + resolve() + }, SYNCHRONIZE_DELAY_IN_MS) + }) }