Segment editing.
This commit is contained in:
1 parent
fba7e12c36
commit
2dbcf63eeb
22 files changed
+306
-42
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { useApi } from '../useApi';
|
||||
import { useModified } from '@/components/hooks';
|
||||
import { keepPreviousData } from '@tanstack/react-query';
|
||||
import { ReactQueryOptions } from '@/lib/types';
|
||||
|
||||
export function useWebsiteSegmentQuery(
|
||||
websiteId: string,
|
||||
segmentId: string,
|
||||
options?: ReactQueryOptions<any>,
|
||||
) {
|
||||
const { get, useQuery } = useApi();
|
||||
const { modified } = useModified(`segments`);
|
||||
|
||||
return useQuery({
|
||||
queryKey: ['website:segments', { websiteId, segmentId, modified }],
|
||||
queryFn: () => get(`/websites/${websiteId}/segments/${segmentId}`),
|
||||
enabled: !!(websiteId && segmentId),
|
||||
placeholderData: keepPreviousData,
|
||||
...options,
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user