Answer the question
In order to leave comments, you need to log in
How to properly unsubscribe from subscriptions in Angular?
Do I need to unsubscribe from a subscription to a subscription? Or can you get away with the 1st unsubscribe?
this.authService.getUuid()
.pipe(untilDestroyed(this)) // 1-я отписка
.subscribe(phraseFromServer => {
this.authService.sendPhraseToPlugin()
.pipe(untilDestroyed(this)) // 2-я отписка
.subscribe(signedCert => {
this.signedCert = signedCert;
}
}
Answer the question
In order to leave comments, you need to log in
Better like this:
this.authService.getUuid().pipe(
switchMap(phraseFromServer => this.authService.sendPhraseToPlugin()),
untilDestroyed(this),
).subscribe(signedCert => {
this.signedCert = signedCert;
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question