How to get pagination from a store without a subscription?

Viewed 36

I have a button that refresh various data. And I had such a question: how to pass pagination on request? Do I really need to subscribe? Can you somehow get around this? I will have many more similar requests and I will have to unsubscribe from them all.

This is what I have now:

  pageSize = 10;

  page = 1;

  refresh() {
    this.store$.dispatch(setLoadingSpinner({ status: true }));

    this.store$.pipe(select(selectPagination)).subscribe((data) => {
      this.page = data.page,
      this.pageSize = data.pageSize
    })

    this.store$.dispatch(
      loadNotifications({ page: this.page, pageSize: this.pageSize })
    );
  }
0 Answers
Related