Skip to content
This repository was archived by the owner on May 11, 2021. It is now read-only.
This repository was archived by the owner on May 11, 2021. It is now read-only.

How to get .catch operator working? #19

@RavenHursT

Description

@RavenHursT

I've added import 'rxjs/add/operator/catch' to the top of my epic file using RxHR.post()

But for some reason I'm still getting .catch is not a function

import {
  SIGN_IN_INIT,
  SIGN_IN_SUCCESS,
  SIGN_IN_FAILURE
} from './sign-in.actions'
import {Observable} from 'rxjs'
import AuthService from '../../../services/authentication.service'
import 'rxjs/add/operator/catch'

const signInEpic = action$ => {
  return action$.ofType(SIGN_IN_INIT)
  .mergeMap(
    action => {
      return AuthService.signIn(
        action.credentials.username,
        action.credentials.password
      )
      .map(response => ({
        type: SIGN_IN_SUCCESS,
        response
      }))
      .catch(error => Observable.of({
        type: SIGN_IN_FAILURE,
        error
      }))
    }
  )
}

export default signInEpic
``

`AuthService.signIn()` is just a function that returns the `baseRequest` from `RxHR.defaults()`

even adding `import 'rxjs/Rx' doesn't work...

Really at a loss as to how to do error handling w/ this?

Any ideas?

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions