So I have 3 observables: updateCustomUserData$, updateEmail$, updatePassword$. And profileEditForm. I need to update profile data if appropriate fields of form was changed; I think it should look like this:
updateCustomUserData$(data) {
return iif(() => customDataWasChanged(), apiService.updateCustomUserData())
}
// updateEmail$ and updatePassword$ is similar
onSubmit() {
this.updateCustomUserData$(formData).pipe(
concatMap(() => this.updateEmail$(newEmail))),
concatMap(() => this.updatePassword$(newPassword),
)
.subscribe(() => doSomething())
}
But it is not working. If custom data was not changed and password or email do - updateEmail & updatePassword is not executing. Is anybody can help? P.S. Sorry for my English:)