mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import type { Slice } from "@services/DateService";
|
||||
import DateService from "@services/DateService";
|
||||
import type { MetricsCounts } from "~/server/api/metrics/[project_id]/counts";
|
||||
import type { VisitsWebsiteAggregated } from "~/server/api/metrics/[project_id]/data/websites";
|
||||
import type { MetricsTimeline } from "~/server/api/metrics/[project_id]/timeline/generic";
|
||||
@@ -14,6 +16,19 @@ export function useFirstInteractionData() {
|
||||
return metricsInfo;
|
||||
}
|
||||
|
||||
export async function useVisitsTimeline(fromDate: string, toDate: string, slice: Slice) {
|
||||
const { from, to } = DateService.prepareDateRange(fromDate, toDate, slice);
|
||||
const activeProject = useActiveProject();
|
||||
const response = await $fetch(
|
||||
`/api/metrics/${activeProject.value?._id}/timeline/visits`, {
|
||||
method: 'POST',
|
||||
...signHeaders({ 'Content-Type': 'application/json' }),
|
||||
body: JSON.stringify({ slice, from, to })
|
||||
});
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
export async function useTimelineDataRaw(timelineEndpointName: string, slice: SliceName) {
|
||||
const activeProject = useActiveProject();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user