Last active
August 12, 2021 12:44
-
-
Save rainerhahnekamp/abd8cee442fe2e30cdc75808fbae8c4c to your computer and use it in GitHub Desktop.
This file contains 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 characters
@Injectable() | |
export class CustomerEffects { | |
private baseUrl = 'https://local.eternal.com/api/customer'; | |
constructor( | |
private actions$: Actions, | |
private http: HttpClient, | |
private router: Router | |
) {} | |
loadCustomers$ = createEffect(() => | |
this.actions$.pipe( | |
ofType(CustomerActions.load), | |
switchMap(() => this.http.get<Customer[]>(this.baseUrl)), | |
map(customers => CustomerActions.loaded({ customers })) | |
) | |
); | |
// addCustomer$, updateCustomer$, removeCustomer$... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment