mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 23:27:12 +01:00
Updated hooks. Changed url, host to path, hostname.
This commit is contained in:
parent
25a9c011b3
commit
543674c7f2
146 changed files with 23348 additions and 2533 deletions
|
|
@ -1,19 +1,25 @@
|
|||
import { getMinimumUnit, parseDateRange } from '@/lib/date';
|
||||
import { setItem } from '@/lib/storage';
|
||||
import { DATE_RANGE_CONFIG, DEFAULT_DATE_COMPARE, DEFAULT_DATE_RANGE } from '@/lib/constants';
|
||||
import { useWebsites, setWebsiteDateRange, setWebsiteDateCompare } from '@/store/websites';
|
||||
import { useApp, setDateRange } from '@/store/app';
|
||||
import { setWebsiteDateCompare, setWebsiteDateRange, useWebsites } from '@/store/websites';
|
||||
import { setDateRange, useApp } from '@/store/app';
|
||||
import { DateRange } from '@/lib/types';
|
||||
import { useLocale } from './useLocale';
|
||||
import { useApi } from './useApi';
|
||||
import { useNavigation } from './useNavigation';
|
||||
|
||||
export function useDateRange(websiteId?: string) {
|
||||
const { get } = useApi();
|
||||
const { locale } = useLocale();
|
||||
const {
|
||||
query: { date },
|
||||
} = useNavigation();
|
||||
const websiteConfig = useWebsites(state => state[websiteId]?.dateRange);
|
||||
const defaultConfig = DEFAULT_DATE_RANGE;
|
||||
const globalConfig = useApp(state => state.dateRange);
|
||||
const dateRange = parseDateRange(websiteConfig || globalConfig || defaultConfig, locale);
|
||||
const dateRange = parseDateRange(
|
||||
date || websiteConfig || globalConfig || DEFAULT_DATE_RANGE,
|
||||
locale,
|
||||
);
|
||||
const dateCompare = useWebsites(state => state[websiteId]?.dateCompare || DEFAULT_DATE_COMPARE);
|
||||
|
||||
const saveDateRange = async (value: DateRange | string) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue