Sawtaytoes
9/30/2018 - 5:31 AM

Store User Info

You might want to modify Redux's state using an epic. This is as easy as listening for an action and calling another action.

const storeUserInfoEpic = (
  action$,
) => (
  action$
  .pipe(
    ofType(UPDATE_USER_INFO),
    map(({
      authInfo,
      userInfo,
    }) => ({
      accessToken: authInfo.accessToken,
      emailAddress: userInfo.email,
      username: userInfo.username,
    })),
    map(storeUserInfo),
  )
)