title: How to emit multiple actions in one epic using redux-observable?
body: <p>I'm new to rxjs/redux observable and want to do two things:</p>
  
  <p>1) improve this epic to be more idiomatic</p>
  
  <p>2) dispatch two actions from a single epic</p>
  
  <p>Most of the examples I see assume that the api library will throw an exception when a fetch fails, but i've designed mine to be a bit more predictable, and with Typescript union types I'm forced to check an <code>ok: boolean</code> value before I can unpack the results, so understanding how to do this in rxjs has been a bit more challenging. </p>
  
  <p>What's the best way to improve the following? If the request is successful, I'd like to emit both a success action (meaning the user is authorized) and also a 'fetch account' action, which is a separate action because there may be times where I need to fetch the account outside of just 'logging in'. Any help would be greatly appreciated!</p>
  
  <pre><code>const authorizeEpic: Epic&lt;ActionTypes, ActionTypes, RootState&gt; = action$ =&gt;
    action$.pipe(
      filter(isActionOf(actions.attemptLogin.request)),
      switchMap(async val =&gt; {
        if (!val.payload) {
          try {
            const token: Auth.Token = JSON.parse(
              localStorage.getItem(LOCAL_STORAGE_KEY) || ""
            );
            if (!token) {
              throw new Error();
            }
            return actions.attemptLogin.success({
              token
            });
          } catch (e) {
            return actions.attemptLogin.failure({
              error: {
                title: "Unable to decode JWT"
              }
            });
          }
        }
  
        const resp = await Auth.passwordGrant(
          {
            email: val.payload.email,
            password: val.payload.password,
            totp_passcode: ""
          },
          {
            url: "localhost:8088",
            noVersion: true,
            useHttp: true
          }
        );
  
        if (resp.ok) {
          return [
            actions.attemptLogin.success({
              token: resp.value
            })
            // EMIT action 2, etc...
          ];
        }
  
        return actions.attemptLogin.failure(resp);
      })
    );
  </code></pre>