Skip to content

Commit

Permalink
Added: Succes pipe and code cleanup (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidelcheikh authored Aug 18, 2023
1 parent 76e4097 commit 2252dfd
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Utils publish on tag
name: npm publish on tag

on:
push:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
3 changes: 2 additions & 1 deletion ngrx-http-tracking/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
chrome-profiler-events*.json

# IDEs and editors
/.idea
.idea
.project
.classpath
.c9/
Expand Down Expand Up @@ -43,3 +43,4 @@ testem.log
# System Files
.DS_Store
Thumbs.db

Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ export const createTrackingActions = <TRequest, TPayload>(
props<{ request: TRequest }>()
),
loaded: createTrackingAction(
`[${namespace}] ${actionName}Success`,
`[${namespace}] ${actionName} Success`,
hasGlobalTag,
tags,
LoadingState.LOADED,
props<{ payload: TPayload }>()
),
failure: createTrackingFailureAction(
`[${namespace}] ${actionName}Failure`,
`[${namespace}] ${actionName} Failure`,
hasGlobalTag,
tags,
convertResponseToError
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const mapActionTypeToId = (actionType: string) =>
actionType
.toLowerCase()
.replace(/success/g, '')
.replace(/failure/g, '')
.replace(/ success/g, '')
.replace(/ failure/g, '')
.trim()
.replace(/ /g, '-');
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {Observable} from "rxjs";
import {HttpTrackingResult} from "../+state/http-tracking.facade";
export function httpTrackingSuccessFilter(source: Observable<HttpTrackingResult<any, any>>): Observable<boolean> {
return new Observable(subscriber => {
source.subscribe({
next(value) {
if (value.success) {
return subscriber.next(true);
}
},
error(error) {
subscriber.error(error);
},
complete() {
subscriber.complete();
},
});
});
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/*
* Public API Surface of http-tracking
*/
export * from './lib/+state/http-tracking-facade.stub';
export * from './lib/+state/http-tracking.facade';
export * from './lib/function/http-tracking-actions.factory';
export * from './lib/http-tracking.module';
export * from './lib/model/http-tracking-entity';
export * from './lib/function/tracking-success-pipe';

0 comments on commit 2252dfd

Please sign in to comment.