first commit
Some checks failed
Build / run (push) Has been cancelled

This commit is contained in:
maher
2025-10-29 11:42:25 +01:00
commit 703f50a09d
4595 changed files with 385164 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import {useQuery} from '@tanstack/react-query';
import {apiClient} from '@common/http/query-client';
import {useAuth} from '@common/auth/use-auth';
import {PaginatedBackendResponse} from '@common/http/backend-response/pagination-response';
import {Channel} from '@common/channels/channel';
import {DatatableDataQueryKey} from '@common/datatable/requests/paginated-resources';
export interface FetchAllUserListsResponse
extends PaginatedBackendResponse<Channel> {}
export function useAllUserLists() {
const {user} = useAuth();
const params = {
userId: user?.id,
type: 'list',
perPage: 100,
loadItemsCount: true,
loadFirstItems: true,
};
return useQuery({
queryKey: DatatableDataQueryKey('channel', params),
queryFn: () => fetchLists(params),
enabled: !!user,
});
}
function fetchLists(params: Record<string, any>) {
return apiClient
.get<FetchAllUserListsResponse>(`channel`, {params})
.then(response => response.data);
}