Add sharing to pixel and link detail pages
This commit is contained in:
1 parent
c4226bc63d
commit
64bf4c378c
23 files changed
+582
-43
No files matched your search
@@ -22,9 +22,11 @@ export * from './queries/useEventDataPropertiesQuery';
|
||||
export * from './queries/useEventDataQuery';
|
||||
export * from './queries/useEventDataValuesQuery';
|
||||
export * from './queries/useLinkQuery';
|
||||
export * from './queries/useLinkSharesQuery';
|
||||
export * from './queries/useLinksQuery';
|
||||
export * from './queries/useLoginQuery';
|
||||
export * from './queries/usePixelQuery';
|
||||
export * from './queries/usePixelSharesQuery';
|
||||
export * from './queries/usePixelsQuery';
|
||||
export * from './queries/useRealtimeQuery';
|
||||
export * from './queries/useReplayQuery';
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { ReactQueryOptions } from '@/lib/types';
|
||||
import { useApi } from '../useApi';
|
||||
import { useModified } from '../useModified';
|
||||
import { usePagedQuery } from '../usePagedQuery';
|
||||
|
||||
export function useLinkSharesQuery(
|
||||
{ linkId }: { linkId: string },
|
||||
options?: ReactQueryOptions,
|
||||
) {
|
||||
const { modified } = useModified('shares');
|
||||
const { get } = useApi();
|
||||
|
||||
return usePagedQuery({
|
||||
queryKey: ['linkShares', { linkId, modified }],
|
||||
queryFn: pageParams => {
|
||||
return get(`/links/${linkId}/shares`, pageParams);
|
||||
},
|
||||
...options,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import type { ReactQueryOptions } from '@/lib/types';
|
||||
import { useApi } from '../useApi';
|
||||
import { useModified } from '../useModified';
|
||||
import { usePagedQuery } from '../usePagedQuery';
|
||||
|
||||
export function usePixelSharesQuery(
|
||||
{ pixelId }: { pixelId: string },
|
||||
options?: ReactQueryOptions,
|
||||
) {
|
||||
const { modified } = useModified('shares');
|
||||
const { get } = useApi();
|
||||
|
||||
return usePagedQuery({
|
||||
queryKey: ['pixelShares', { pixelId, modified }],
|
||||
queryFn: pageParams => {
|
||||
return get(`/pixels/${pixelId}/shares`, pageParams);
|
||||
},
|
||||
...options,
|
||||
});
|
||||
}
|
||||
@@ -2,7 +2,9 @@ import { useConfig } from '@/components/hooks/useConfig';
|
||||
import { LINKS_URL, PIXELS_URL } from '@/lib/constants';
|
||||
|
||||
export function useSlug(type: 'link' | 'pixel') {
|
||||
const { linksUrl, pixelsUrl } = useConfig();
|
||||
const config = useConfig();
|
||||
const linksUrl = config?.linksUrl;
|
||||
const pixelsUrl = config?.pixelsUrl;
|
||||
|
||||
const hostUrl = type === 'link' ? linksUrl || LINKS_URL : pixelsUrl || PIXELS_URL;
|
||||
|
||||
|
||||
Reference in new issue
Block a user