All files / store/reducers/posts posts-selectors.ts

0% Statements 0/12
100% Branches 0/0
0% Functions 0/6
0% Lines 0/8

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                               
import { RootState } from '@/store';
import { HNItem } from '@/types/hackernews';
 
export const selectPostsLoading = (state: RootState): boolean => state.posts.loading;
export const selectPostsError = (state: RootState): string | null => state.posts.error;
export const selectCurrentPage = (state: RootState): number => state.posts.currentPage;
export const selectTotalPages = (state: RootState): number => state.posts.totalPages;
 
export const selectNewPosts = (state: RootState): Partial<HNItem>[] => {
  return state.posts.newPostItems;
};
 
export const selectTopPosts = (state: RootState): Partial<HNItem>[] => {
  return state.posts.topPostItems;
};