implementig snapshots

This commit is contained in:
Emily
2024-07-26 14:28:29 +02:00
parent af32669b32
commit fc78b3bb43
3 changed files with 38 additions and 8 deletions

View File

@@ -5,11 +5,21 @@ import type { IconProvider } from './BarsCard.vue';
import ReferrerBarChart from '../referrer/ReferrerBarChart.vue';
const activeProject = await useActiveProject();
const { safeSnapshotDates, snapshot } = useSnapshot();
const { data: events, pending, refresh } = await useFetch<ReferrersAggregated[]>(`/api/metrics/${activeProject.value?._id}/data/referrers`, {
...signHeaders(),
...signHeaders({
'x-from': safeSnapshotDates.value.from,
'x-to': safeSnapshotDates.value.to
}),
lazy: true
});
watch(snapshot,()=>{
refresh();
})
function iconProvider(id: string): ReturnType<IconProvider> {
if (id === 'self') return ['icon', 'fas fa-link'];