UNPKG

@selfcommunity/react-core

Version:

React Core Components useful for integrating UI Community components (react-ui).

52 lines (51 loc) 1.54 kB
import { SCFeedUnitType } from '@selfcommunity/types'; import { EndpointType, SCPaginatedResponse } from '@selfcommunity/api-services'; import { CacheStrategies } from '@selfcommunity/utils'; /** * Interface SCPaginatedFeedType */ export interface SCPaginatedFeedType { componentLoaded: boolean; results: SCFeedUnitType[]; count: number; next: string; previous: string; isLoadingNext: boolean; isLoadingPrevious: boolean; currentPage: number; currentOffset: number; reload: boolean; } /** * @hidden * We have complex state logic that involves multiple sub-values, * so useReducer is preferable to useState. * Define all possible auth action types label * Use this to export actions and dispatch an action */ export declare const feedDataActionTypes: { LOADING_NEXT: string; LOADING_PREVIOUS: string; DATA_NEXT_LOADED: string; DATA_PREVIOUS_LOADED: string; DATA_REVALIDATE: string; DATA_RELOAD: string; DATA_RELOADED: string; UPDATE_DATA: string; RESET: string; }; /** :::info This custom hooks is used to fetch paginated Data. ::: * @param props */ export default function useSCFetchFeed(props: { id: string; endpoint: EndpointType; endpointQueryParams?: Record<string, string | number>; onNextPage?: (page: any, offset: any, total: any, data: any) => any; onPreviousPage?: (page: any, offset: any, total: any, data: any) => any; cacheStrategy?: CacheStrategies; prefetchedData?: SCPaginatedResponse<SCFeedUnitType>; }): any;