Skip to content

Commit e357372

Browse files
committed
update NgRx Data 6.0.0-beta 6 / breaking changes with EntityActions
1 parent 89057ea commit e357372

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

src/angular/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/angular/package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
"test": "ng test",
1010
"lint": "ng lint",
1111
"e2e": "ng e2e",
12-
"dbmock":
13-
"json-server --watch server.json --port 3004 --routes routes.json",
14-
"compodoc":
15-
"./node_modules/.bin/compodoc -p src/tsconfig.app.json --disableSourceCode --disableDomTree --disableTemplateTab --disableGraph",
12+
"dbmock": "json-server --watch server.json --port 3004 --routes routes.json",
13+
"compodoc": "./node_modules/.bin/compodoc -p src/tsconfig.app.json --disableSourceCode --disableDomTree --disableTemplateTab --disableGraph",
1614
"compodoc-all": "./node_modules/.bin/compodoc -p src/tsconfig.app.json"
1715
},
1816
"private": true,
@@ -34,7 +32,7 @@
3432
"@ngrx/store-devtools": "^6.0.1",
3533
"bootstrap": "^4.1.1",
3634
"core-js": "^2.5.6",
37-
"ngrx-data": "^6.0.0-beta.5",
35+
"ngrx-data": "^6.0.0-beta.6",
3836
"ngx-toastr": "^8.7.3",
3937
"rxjs": "^6.2.0",
4038
"rxjs-compat": "^6.1.0",

src/angular/src/app/services/toast.service.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
import { Injectable } from '@angular/core';
2-
import { EntityActions, OP_ERROR, OP_SUCCESS } from 'ngrx-data';
2+
import { EntityAction, OP_ERROR, OP_SUCCESS, ofEntityOp } from 'ngrx-data';
33
import { ToastrService } from 'ngx-toastr';
4+
import { Actions } from '@ngrx/effects';
5+
import { filter } from 'rxjs/operators';
46

57
@Injectable()
68
export class ToastService {
7-
constructor(actions$: EntityActions, private toastrservice: ToastrService) {
9+
constructor(actions$: Actions, private toastrservice: ToastrService) {
810
actions$
9-
.where(ea => ea.op.endsWith(OP_SUCCESS) || ea.op.endsWith(OP_ERROR))
11+
.pipe(
12+
ofEntityOp(),
13+
filter(
14+
(ea: EntityAction) =>
15+
ea.op.endsWith(OP_SUCCESS) || ea.op.endsWith(OP_ERROR)
16+
)
17+
)
1018
// this service never dies so no need to unsubscribe
1119
.subscribe(action =>
1220
// this is a hack against "expression changed" bug listed here https://github.com/scttcper/ngx-toastr/issues/160

0 commit comments

Comments
 (0)