Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schematics: add common success/failure actions to feature schematic #1529

Closed
brandonroberts opened this issue Jan 25, 2019 · 1 comment · Fixed by #1530
Closed

Schematics: add common success/failure actions to feature schematic #1529

brandonroberts opened this issue Jan 25, 2019 · 1 comment · Fixed by #1530

Comments

@brandonroberts
Copy link
Member

brandonroberts commented Jan 25, 2019

When a feature schematic is run, we scaffold out [Something] Load Something. In lots of cases you end up with, [Something] Load Something, [Something] Load Something Success, [Something] Load Something Failure.

We should provide some type of option that adds the success/error actions to the action/reducer/effect when generating a feature. The piece that's unknown is what to put in the *Map for the effect.

@Injectable()
export class SomethingEffect {
  @Effect()
  this.loadSomething$ = this.actions$.pipe(
    oftype('SomeAction'),
    (concat/exhaust/blah)Map(() => 
      (/** some observable to be replaced here */).pipe(
        map(() => new LoadSomethingSuccess()),
        catchError(() => of(new LoadSomethingFailure))
      )
    )
  )
}
@wesleygrimes
Copy link
Contributor

If you're accepting PRs, I will give this one a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants