From 5cf479c9783faf08edc445f629371ff0ebaf1557 Mon Sep 17 00:00:00 2001 From: doubleface Date: Tue, 5 Apr 2022 10:34:20 +0200 Subject: [PATCH] feat: Do not mark a job as succeeded on login success --- packages/cozy-harvest-lib/src/models/ConnectionFlow.js | 3 ++- .../src/models/konnector/KonnectorJobWatcher.js | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/cozy-harvest-lib/src/models/ConnectionFlow.js b/packages/cozy-harvest-lib/src/models/ConnectionFlow.js index 137faa6893..964ef14d0c 100644 --- a/packages/cozy-harvest-lib/src/models/ConnectionFlow.js +++ b/packages/cozy-harvest-lib/src/models/ConnectionFlow.js @@ -344,7 +344,8 @@ export class ConnectionFlow { } handleLoginSuccess() { - this.jobWatcher.handleSuccess() + this.jobWatcher.handleLoginSuccess() + this.triggerEvent(LOGIN_SUCCESS_EVENT) } handleLoginSuccessHandled() { diff --git a/packages/cozy-harvest-lib/src/models/konnector/KonnectorJobWatcher.js b/packages/cozy-harvest-lib/src/models/konnector/KonnectorJobWatcher.js index 19371ffde8..d705d00da1 100644 --- a/packages/cozy-harvest-lib/src/models/konnector/KonnectorJobWatcher.js +++ b/packages/cozy-harvest-lib/src/models/konnector/KonnectorJobWatcher.js @@ -66,6 +66,11 @@ export class KonnectorJobWatcher { this.emit('error', new KonnectorJobError(error)) } + handleLoginSuccess() { + logger.info(`KonnectorJobWatcher: login success`) + this.disableSuccessTimer() + } + handleSuccess() { logger.info(`KonnectorJobWatcher: Job has succeeded`) this.disableSuccessTimer()