Archived
cokolwiek
This commit is contained in:
1 parent
5801ecfd29
commit
d8c8482696
36 files changed
+745
-508
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Actions, createEffect, ofType } from '@ngrx/effects';
|
||||
import { first, switchMap } from 'rxjs';
|
||||
import { IssueModel } from 'src/app/models/issue.model';
|
||||
import { IssueService } from 'src/app/services/issues.service';
|
||||
import {
|
||||
receiveAllIssuesAction,
|
||||
receivedAllIssuesSuccessAction,
|
||||
} from '../actions/issue.actions';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class IssueEffect {
|
||||
preloadAutomaticOffer$ = createEffect(() => {
|
||||
return this.actions$.pipe(
|
||||
ofType(receiveAllIssuesAction),
|
||||
switchMap((action) => this.issueService.getIssues()),
|
||||
switchMap((issues: IssueModel[]) => [
|
||||
receivedAllIssuesSuccessAction({ issues }),
|
||||
]),
|
||||
first()
|
||||
);
|
||||
});
|
||||
|
||||
constructor(private actions$: Actions, private issueService: IssueService) {}
|
||||
}
|
||||
Reference in new issue
Block a user