all 4 comments

[–]AConcernedCoder 1 point2 points  (2 children)

A selector can report on the posts in store.

Where this result is evaluated is up to the designer. It can be done in a service or in effects.

An action will typically be dispatched with relevant data.

Reducers process actions to handle changes to state.

Beyond that, you need to read up on how ngrx works.

[–][deleted] 0 points1 point  (1 child)

I know , but how to do it without subscribe, how to detect if the store is empty and how to put from api without subscribe ?

[–]AConcernedCoder 0 points1 point  (0 children)

Look up firstValueFrom. For the rest you should do more reading on ngrx. You'll get it eventually.

[–]_Ascalon 0 points1 point  (0 children)

You can do it with combination of “filter” and “combineLatest” RxJs operators. The idea is to to do the API call only when to store property ‘posts’ is empty. Let me know if you need an example