Last active
November 12, 2019 22:52
-
-
Save peterbsmyth/1349e74a91de7e36b0055319ae6b942c to your computer and use it in GitHub Desktop.
Revisions
-
Peter B Smith revised this gist
Nov 12, 2019 . 2 changed files with 31 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ @Injectable() export class Effects { getPending$ = createEffect(() => this.actions$.pipe( ofType(ApprovalActions.getAllPendingApprovals), switchMap(res => this.apiService.getAllPendingApprovals() ), map((approvals) => ApprovalActions.getAllPendingApprovalsComplete({ approvals })) ) ); savePhoto$ = createEffect(() => this.actions$.pipe( ofType( NewExpenseActions.takePhotoComplete, NewExpenseActions.selectPhotoLibraryComplete ), tap(() => { this.routerExtensions.navigateByUrl('/create-expense', { clearHistory: true }); // MOBILE ONLY }), switchMap(({ uri }) => this.apiService.saveOneExpenseReceipt(uri)), // MOBILE ONLY map((token) => NewExpenseActions.savePhotoComplete({ token })) ) ); constructor( private actions$: Actions, private apiService: ApiService ) { } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,20 +18,6 @@ export class Effects { }) ), { dispatch: false } ); constructor( private actions$: Actions, -
Peter B Smith created this gist
Nov 11, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ @Injectable() export class Effects { getPending$ = createEffect(() => this.actions$.pipe( ofType(ApprovalActions.getAllPendingApprovals), switchMap(res => this.apiService.getAllPendingApprovals() ), map((approvals) => ApprovalActions.getAllPendingApprovalsComplete({ approvals })) ) ); openModal$ = createEffect(() => this.actions$.pipe( ofType(ModalActions.openModal), tap(({ name }) => { this.modalService.open(name); // WEB ONLY }) ), { dispatch: false } ); savePhoto$ = createEffect(() => this.actions$.pipe( ofType( NewExpenseActions.takePhotoComplete, NewExpenseActions.selectPhotoLibraryComplete ), tap(() => { this.routerExtensions.navigateByUrl('/create-expense', { clearHistory: true }); // MOBILE ONLY }), switchMap(({ uri }) => this.apiService.saveOneExpenseReceipt(uri)), // MOBILE ONLY map((token) => NewExpenseActions.savePhotoComplete({ token })) ) ); constructor( private actions$: Actions, private apiService: ApiService, private modalService: BaseModalService ) { } }