I have this situation:
this._userService
.create(user)
.pipe(
switchMap(res => {
if (this.accountStore.accounts.length > 0) {
return this._accountsService.manageAccounts(
accounts,
res.idUser
);
} else return of();
})
)
.subscribe(
_ => {
this._router.navigate(["/app/main/user/"]);
},
() => (this.saving = false)
);
if the accounts are higher then 0, it works ok. But if it goes to the else block, the return of()
doesn't execute the next() to navigate to the user route;
What am I doing wrong?