@ai-growth/nextjs
Version:
Seamlessly integrate Sanity CMS with Next.js applications for automated blog routing and rendering
34 lines • 1.3 kB
TypeScript
import { type ContentListOptions } from '../utils';
import type { CmsContent } from '../types';
export interface UseCmsContentListOptions extends ContentListOptions {
contentType: string;
enabled?: boolean;
onSuccess?: (data: CmsContent[]) => void;
onError?: (error: Error) => void;
staleTime?: number;
}
export interface UseCmsContentListResult {
content: CmsContent[];
isLoading: boolean;
isError: boolean;
error: Error | null;
isFetching: boolean;
hasMore: boolean;
totalCount?: number;
refetch: () => Promise<void>;
loadMore: () => Promise<void>;
reset: () => void;
}
/**
* React hook for fetching lists of CMS content with pagination
*/
export declare function useCmsContentList(options: UseCmsContentListOptions): UseCmsContentListResult;
/**
* Hook for fetching featured/recent content
*/
export declare function useFeaturedContent(contentType?: string, limit?: number, options?: Omit<UseCmsContentListOptions, 'contentType' | 'limit'>): UseCmsContentListResult;
/**
* Hook for fetching recent content
*/
export declare function useRecentContent(contentType?: string, limit?: number, options?: Omit<UseCmsContentListOptions, 'contentType' | 'limit'>): UseCmsContentListResult;
//# sourceMappingURL=useCmsContentList.d.ts.map