From 396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b Mon Sep 17 00:00:00 2001 From: Fuwn <50817549+Fuwn@users.noreply.github.com> Date: Sat, 24 Jan 2026 13:09:50 +0000 Subject: Initial commit Created from https://vercel.com/new --- .../hooks/queries/useUserWebsitesQuery.ts | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/components/hooks/queries/useUserWebsitesQuery.ts (limited to 'src/components/hooks/queries/useUserWebsitesQuery.ts') diff --git a/src/components/hooks/queries/useUserWebsitesQuery.ts b/src/components/hooks/queries/useUserWebsitesQuery.ts new file mode 100644 index 0000000..f98eaff --- /dev/null +++ b/src/components/hooks/queries/useUserWebsitesQuery.ts @@ -0,0 +1,31 @@ +import type { ReactQueryOptions } from '@/lib/types'; +import { useApi } from '../useApi'; +import { useModified } from '../useModified'; +import { usePagedQuery } from '../usePagedQuery'; + +export function useUserWebsitesQuery( + { userId, teamId }: { userId?: string; teamId?: string }, + params?: Record, + options?: ReactQueryOptions, +) { + const { get } = useApi(); + const { modified } = useModified(`websites`); + + return usePagedQuery({ + queryKey: ['websites', { userId, teamId, modified, ...params }], + queryFn: pageParams => { + return get( + teamId + ? `/teams/${teamId}/websites` + : userId + ? `/users/${userId}/websites` + : '/me/websites', + { + ...pageParams, + ...params, + }, + ); + }, + ...options, + }); +} -- cgit v1.2.3