title: A better way to write if..else block in typescript with network call in between
body: <p>I find myself writing a lot of code like this;</p>
  <pre><code>if(cond){
     /*do some network call */
     this.networkService.invoke(params).subscribe((res) =&gt; {
        this.doSomething();
     })
  }else{
     /* do something without calling the network */
     this.doSomething();
  }
  </code></pre>
  <p>Essentially, <code>this.doSomething();</code> has to be called whether the condition is met or not. If the <code>cond === true</code>, then do some network call, then <code>this.doSomething()</code>. Is there a better way to write such code?</p>