Initial commit
Build / run (push) Has been cancelled

This commit is contained in:
maher
2026-05-14 13:42:10 +02:00
commit 511fad8199
4595 changed files with 385164 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
import {Commentable} from '@common/comments/commentable';
import {Comment} from '@common/comments/comment';
import {useInfiniteData} from '@common/ui/infinite-scroll/use-infinite-data';
interface QueryParams {
perPage?: number;
}
export function commentsQueryKey(
commentable: Commentable,
params: QueryParams = {}
) {
return ['comment', `${commentable.id}-${commentable.model_type}`, params];
}
export function useComments(
commentable: Commentable,
params: QueryParams = {}
) {
return useInfiniteData<Comment>({
queryKey: commentsQueryKey(commentable, params),
endpoint: 'commentable/comments',
//paginate: 'cursor',
queryParams: {
commentable_type: commentable.model_type,
commentable_id: commentable.id,
...params,
},
});
}