Skip to content

Commit 2252dfd

Browse files
Added: Succes pipe and code cleanup (#11)
1 parent 76e4097 commit 2252dfd

File tree

7 files changed

+28
-9
lines changed

7 files changed

+28
-9
lines changed

.github/workflows/npm-publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Utils publish on tag
1+
name: npm publish on tag
22

33
on:
44
push:

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

ngrx-http-tracking/.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
chrome-profiler-events*.json
1414

1515
# IDEs and editors
16-
/.idea
16+
.idea
1717
.project
1818
.classpath
1919
.c9/
@@ -43,3 +43,4 @@ testem.log
4343
# System Files
4444
.DS_Store
4545
Thumbs.db
46+

ngrx-http-tracking/projects/ngrx-http-tracking/src/lib/function/http-tracking-actions.factory.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,14 @@ export const createTrackingActions = <TRequest, TPayload>(
162162
props<{ request: TRequest }>()
163163
),
164164
loaded: createTrackingAction(
165-
`[${namespace}] ${actionName}Success`,
165+
`[${namespace}] ${actionName} Success`,
166166
hasGlobalTag,
167167
tags,
168168
LoadingState.LOADED,
169169
props<{ payload: TPayload }>()
170170
),
171171
failure: createTrackingFailureAction(
172-
`[${namespace}] ${actionName}Failure`,
172+
`[${namespace}] ${actionName} Failure`,
173173
hasGlobalTag,
174174
tags,
175175
convertResponseToError
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export const mapActionTypeToId = (actionType: string) =>
22
actionType
33
.toLowerCase()
4-
.replace(/success/g, '')
5-
.replace(/failure/g, '')
4+
.replace(/ success/g, '')
5+
.replace(/ failure/g, '')
66
.trim()
77
.replace(/ /g, '-');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {Observable} from "rxjs";
2+
import {HttpTrackingResult} from "../+state/http-tracking.facade";
3+
export function httpTrackingSuccessFilter(source: Observable<HttpTrackingResult<any, any>>): Observable<boolean> {
4+
return new Observable(subscriber => {
5+
source.subscribe({
6+
next(value) {
7+
if (value.success) {
8+
return subscriber.next(true);
9+
}
10+
},
11+
error(error) {
12+
subscriber.error(error);
13+
},
14+
complete() {
15+
subscriber.complete();
16+
},
17+
});
18+
});
19+
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
/*
2-
* Public API Surface of http-tracking
3-
*/
41
export * from './lib/+state/http-tracking-facade.stub';
52
export * from './lib/+state/http-tracking.facade';
63
export * from './lib/function/http-tracking-actions.factory';
74
export * from './lib/http-tracking.module';
85
export * from './lib/model/http-tracking-entity';
6+
export * from './lib/function/tracking-success-pipe';

0 commit comments

Comments
 (0)