mirror of
https://github.com/umami-software/umami.git
synced 2026-02-18 03:25:40 +01:00
feat: add headers for CF-Access-Client-Id and CF-Access-Client-Secret in API queries across multiple hooks
This commit is contained in:
parent
dc78b5e99d
commit
9d6f794d4d
11 changed files with 11 additions and 11 deletions
|
|
@ -11,7 +11,7 @@ export function useEventDataEvents(
|
||||||
|
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['websites:event-data:events', { websiteId, ...params }],
|
queryKey: ['websites:event-data:events', { websiteId, ...params }],
|
||||||
queryFn: () => get(`/websites/${websiteId}/event-data/events`, { ...params }),
|
queryFn: () => get(`/websites/${websiteId}/event-data/events`, { ...params }, { headers: { 'CF-Access-Client-Id': '571942449727ad914a422562e7931a4a.access', 'CF-Access-Client-Secret': '571942449727ad914a422562e7931a4a.secret' } }),
|
||||||
enabled: !!websiteId,
|
enabled: !!websiteId,
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export function useEventDataProperties(
|
||||||
|
|
||||||
return useQuery<any>({
|
return useQuery<any>({
|
||||||
queryKey: ['websites:event-data:properties', { websiteId, ...params }],
|
queryKey: ['websites:event-data:properties', { websiteId, ...params }],
|
||||||
queryFn: () => get(`/websites/${websiteId}/event-data/properties`, { ...params }),
|
queryFn: () => get(`/websites/${websiteId}/event-data/properties`, { ...params }, { headers: { 'CF-Access-Client-Id': '571942449727ad914a422562e7931a4a.access', 'CF-Access-Client-Secret': '571942449727ad914a422562e7931a4a.secret' } }),
|
||||||
enabled: !!websiteId,
|
enabled: !!websiteId,
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export function useSessionActivity(
|
||||||
return get(`/websites/${websiteId}/sessions/${sessionId}/activity`, {
|
return get(`/websites/${websiteId}/sessions/${sessionId}/activity`, {
|
||||||
startAt: +new Date(startDate),
|
startAt: +new Date(startDate),
|
||||||
endAt: +new Date(endDate),
|
endAt: +new Date(endDate),
|
||||||
});
|
}, { headers: { 'CF-Access-Client-Id': '571942449727ad914a422562e7931a4a.access', 'CF-Access-Client-Secret': '571942449727ad914a422562e7931a4a.secret' } });
|
||||||
},
|
},
|
||||||
enabled: Boolean(websiteId && sessionId && startDate && endDate),
|
enabled: Boolean(websiteId && sessionId && startDate && endDate),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ export function useSessionData(websiteId: string, sessionId: string) {
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['session:data', { websiteId, sessionId }],
|
queryKey: ['session:data', { websiteId, sessionId }],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
return get(`/websites/${websiteId}/sessions/${sessionId}/properties`, { websiteId });
|
return get(`/websites/${websiteId}/sessions/${sessionId}/properties`, { websiteId }, { headers: { 'CF-Access-Client-Id': '571942449727ad914a422562e7931a4a.access', 'CF-Access-Client-Secret': '571942449727ad914a422562e7931a4a.secret' } });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export function useSessionDataProperties(
|
||||||
|
|
||||||
return useQuery<any>({
|
return useQuery<any>({
|
||||||
queryKey: ['websites:session-data:properties', { websiteId, ...params }],
|
queryKey: ['websites:session-data:properties', { websiteId, ...params }],
|
||||||
queryFn: () => get(`/websites/${websiteId}/session-data/properties`, { ...params }),
|
queryFn: () => get(`/websites/${websiteId}/session-data/properties`, { ...params }, { headers: { 'CF-Access-Client-Id': '571942449727ad914a422562e7931a4a.access', 'CF-Access-Client-Secret': '571942449727ad914a422562e7931a4a.secret' } }),
|
||||||
enabled: !!websiteId,
|
enabled: !!websiteId,
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export function useSessionDataValues(
|
||||||
|
|
||||||
return useQuery<any>({
|
return useQuery<any>({
|
||||||
queryKey: ['websites:session-data:values', { websiteId, propertyName, ...params }],
|
queryKey: ['websites:session-data:values', { websiteId, propertyName, ...params }],
|
||||||
queryFn: () => get(`/websites/${websiteId}/session-data/values`, { ...params, propertyName }),
|
queryFn: () => get(`/websites/${websiteId}/session-data/values`, { ...params, propertyName }, { headers: { 'CF-Access-Client-Id': '571942449727ad914a422562e7931a4a.access', 'CF-Access-Client-Secret': '571942449727ad914a422562e7931a4a.secret' } }),
|
||||||
enabled: !!(websiteId && propertyName),
|
enabled: !!(websiteId && propertyName),
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ export function useWebsite(websiteId: string, options?: { [key: string]: any })
|
||||||
|
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['website', { websiteId }],
|
queryKey: ['website', { websiteId }],
|
||||||
queryFn: () => get(`/websites/${websiteId}`),
|
queryFn: () => get(`/websites/${websiteId}`, {}, { headers: { 'CF-Access-Client-Id': '571942449727ad914a422562e7931a4a.access', 'CF-Access-Client-Secret': '571942449727ad914a422562e7931a4a.secret' } }),
|
||||||
enabled: !!websiteId,
|
enabled: !!websiteId,
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ export function useWebsiteEvents(
|
||||||
return usePagedQuery({
|
return usePagedQuery({
|
||||||
queryKey: ['websites:events', { websiteId, ...params }],
|
queryKey: ['websites:events', { websiteId, ...params }],
|
||||||
queryFn: pageParams =>
|
queryFn: pageParams =>
|
||||||
get(`/websites/${websiteId}/events`, { ...params, ...pageParams, pageSize: 20 }),
|
get(`/websites/${websiteId}/events`, { ...params, ...pageParams, pageSize: 20 }, { headers: { 'CF-Access-Client-Id': '571942449727ad914a422562e7931a4a.access', 'CF-Access-Client-Secret': '571942449727ad914a422562e7931a4a.secret' } }),
|
||||||
enabled: !!websiteId,
|
enabled: !!websiteId,
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export function useWebsiteEventsSeries(
|
||||||
|
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['websites:events:series', { websiteId, ...params }],
|
queryKey: ['websites:events:series', { websiteId, ...params }],
|
||||||
queryFn: () => get(`/websites/${websiteId}/events/series`, { ...params }),
|
queryFn: () => get(`/websites/${websiteId}/events/series`, { ...params }, { headers: { 'CF-Access-Client-Id': '571942449727ad914a422562e7931a4a.access', 'CF-Access-Client-Secret': '571942449727ad914a422562e7931a4a.secret' } }),
|
||||||
enabled: !!websiteId,
|
enabled: !!websiteId,
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export function useWebsiteMetrics(
|
||||||
...params,
|
...params,
|
||||||
[searchParams.get('view')]: undefined,
|
[searchParams.get('view')]: undefined,
|
||||||
...queryParams,
|
...queryParams,
|
||||||
});
|
}, { headers: { 'CF-Access-Client-Id': '571942449727ad914a422562e7931a4a.access', 'CF-Access-Client-Secret': '571942449727ad914a422562e7931a4a.secret' } });
|
||||||
|
|
||||||
options?.onDataLoad?.(data);
|
options?.onDataLoad?.(data);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ export function useWebsitePageviews(
|
||||||
|
|
||||||
return useQuery({
|
return useQuery({
|
||||||
queryKey: ['websites:pageviews', { websiteId, ...params, compare }],
|
queryKey: ['websites:pageviews', { websiteId, ...params, compare }],
|
||||||
queryFn: () => get(`/websites/${websiteId}/pageviews`, { ...params, compare }),
|
queryFn: () => get(`/websites/${websiteId}/pageviews`, { ...params, compare }, { headers: { 'CF-Access-Client-Id': '571942449727ad914a422562e7931a4a.access', 'CF-Access-Client-Secret': '0c64ab363f33606ff815a2d871a5eb1776a3b2ba909a4bd2cdd92017d1ab9d1a' } }),
|
||||||
enabled: !!websiteId,
|
enabled: !!websiteId,
|
||||||
...options,
|
...options,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue