mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 06:07:17 +01:00
22 lines
692 B
TypeScript
22 lines
692 B
TypeScript
import { useApi } from '../useApi';
|
|
import { usePagedQuery } from '../usePagedQuery';
|
|
import { useLoginQuery } from './useLoginQuery';
|
|
import { useModified } from '../useModified';
|
|
|
|
export function useWebsites(
|
|
{ userId, teamId }: { userId?: string; teamId?: string },
|
|
params?: { [key: string]: string | number },
|
|
) {
|
|
const { get } = useApi();
|
|
const { user } = useLoginQuery();
|
|
const { modified } = useModified(`websites`);
|
|
|
|
return usePagedQuery({
|
|
queryKey: ['websites', { userId, teamId, modified, ...params }],
|
|
queryFn: () => {
|
|
return get(teamId ? `/teams/${teamId}/websites` : `/users/${userId || user.id}/websites`, {
|
|
...params,
|
|
});
|
|
},
|
|
});
|
|
}
|