1👍
✅
Your if block probably executes before your subscription’s next
finishes. To avoid this you could call observable’s toPromise
to change it into a promise and await it or move the if block to the bottom of subscription’s next
so you make sure you don’t have a race there.
Source:stackexchange.com