From feb16c3fd26b99c6d395b9825ee5273e97b9efb6 Mon Sep 17 00:00:00 2001 From: rr-bw <102181210+rr-bw@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:27:40 -0700 Subject: [PATCH] refactor submit logic --- .../auth/src/angular/login/login.component.ts | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/libs/auth/src/angular/login/login.component.ts b/libs/auth/src/angular/login/login.component.ts index ef46f60e6b3..2fef83ac081 100644 --- a/libs/auth/src/angular/login/login.component.ts +++ b/libs/auth/src/angular/login/login.component.ts @@ -190,25 +190,19 @@ export class LoginComponentV2 implements OnInit, OnDestroy { this.loginEmailService.clearValues(); await this.router.navigate(["update-temp-password"]); } else { - // Browser/Desktop specific (start) - if (this.clientType === ClientType.Browser || this.clientType === ClientType.Desktop) { - await this.syncService.fullSync(true); // TODO-rr-bw: check -> browser uses `await` and desktop uses `return`. Why? - } - // Browser/Desktop specific (end) - - // Web specific (start) - await this.goAfterLogIn(authResult.userId); - // Web specific (end) - - // Browser/Desktop (start) - this.loginEmailService.clearValues(); - - if (this.clientType === ClientType.Browser) { - await this.router.navigate(["/tabs/vault"]); + if (this.clientType === ClientType.Web) { + await this.goAfterLogIn(authResult.userId); } else { - await this.router.navigate(["vault"]); + await this.syncService.fullSync(true); // TODO-rr-bw: browser used `await`, desktop used `return`. Why? + + this.loginEmailService.clearValues(); + + if (this.clientType === ClientType.Browser) { + await this.router.navigate(["/tabs/vault"]); + } else { + await this.router.navigate(["vault"]); // Desktop + } } - // Browser/Desktop (end) } };