Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 1x 1x 1x 1x 1x 1x 1x | import { inject, Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { map, mergeMap } from 'rxjs/operators';
import { httpApiAction } from './http-api.actions';
import { AppHttpApiService } from './services/http-api/http-api.service';
@Injectable({
providedIn: 'root',
})
export class AppHttpApiEffects {
private readonly actions$ = inject(Actions);
private readonly api = inject(AppHttpApiService);
public readonly ping$ = createEffect(() =>
this.actions$.pipe(
ofType(httpApiAction.ping.type),
mergeMap(() => this.api.ping()),
map(payload => httpApiAction.pingSuccess({ payload })),
),
);
}
|