title: How to think Reactively coming from Promise background (angular 2)
body: <p>How does one think and structure code "reactively", coming from a promise background?</p>
  
  <p>I'm struggling with a very simple setup. I have a method <code>.authenticate</code> that should return an observable that yields a boolean (that already makes me fear I'm thinking promishy).</p>
  
  <p>How I'm used to doing things:</p>
  
  <pre><code>authenticate() {    
      if(this.userProfile) {  
          return Promise.resolve(true);  
      }  
      if(!this.jwt) {  
          return Promise.resolve(false); // depending on implementation, either reject or resolve with false  
      }  
      return http.post('/exchangetoken')  
          .then(response =&gt; {  
              this.user = response.data.profile;  
              this.jwt = response.data.jwt;
              return true;  
          })  
          .catch(error =&gt; {
              if(error.status === 400) {
                  return Promise.resolve(false)
              }
              return Promise.reject(error);
          });  
  }  
  </code></pre>
  
  <p>Now in Angular2/TypeScript/ReactiveX I'd like to do the same "reactively"
  check <code>this.userProfile</code> => if <code>true</code> skip the rest and "resolve" <code>true</code>
  check <code>this.jwt</code> => if <code>false</code> skip the rest and "resolve" <code>false</code>
  call some endpoint => if <code>success</code> save states and "resolve" <code>true</code>, if <code>false</code> then "resolve" <code>false</code></p>
  
  <p>Poor attempt so far, I know I'm operators and stuff wrong, but I feel where I'm really going wrong is structuring the process/flow as though I'm building a promise chain:</p>
  
  <pre><code>authenticate(nextUrl: string): Observable&lt;boolean&gt; {
      this.redirectUrl = nextUrl;
  
      if(!!this.userProfile) { return Observable.of(true); }
  
      if(!this.jwt) { return Observable.of(false); }
  
      return this.exchangeToken();
    }
  
  exchangeToken(): Observable&lt;boolean&gt; {
      return this.oeApi
        .post('v1/auth/exchangetoken')
        .map(response =&gt; this.extractProfile(response))
        .catch(error =&gt; {
          console.log(error)
          return Observable.of(false)
        });
    }
  </code></pre>