mirror of
https://github.com/umami-software/umami.git
synced 2026-02-07 22:27:16 +01:00
Converted mutation queries.
This commit is contained in:
parent
3f167e05ba
commit
0f9669f886
34 changed files with 259 additions and 350 deletions
|
|
@ -2,10 +2,10 @@ import { useApi, useModified } from '@/components/hooks';
|
|||
|
||||
export function useDeleteQuery(path: string, params?: Record<string, any>) {
|
||||
const { del, useMutation } = useApi();
|
||||
const { mutate, isPending, error } = useMutation({
|
||||
const query = useMutation({
|
||||
mutationFn: () => del(path, params),
|
||||
});
|
||||
const { touch } = useModified();
|
||||
|
||||
return { mutate, isPending, error, touch };
|
||||
return { ...query, touch };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ import { useToast } from '@umami/react-zen';
|
|||
|
||||
export function useUpdateQuery(path: string, params?: Record<string, any>) {
|
||||
const { post, useMutation } = useApi();
|
||||
const { mutate, isPending, error } = useMutation({
|
||||
const query = useMutation({
|
||||
mutationFn: (data: Record<string, any>) => post(path, { ...data, ...params }),
|
||||
});
|
||||
const { touch } = useModified();
|
||||
const { toast } = useToast();
|
||||
|
||||
return { mutate, isPending, error, touch, toast };
|
||||
return { ...query, touch, toast };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,13 +68,7 @@ export function MetricsTable({
|
|||
};
|
||||
|
||||
return (
|
||||
<LoadingPanel
|
||||
data={data}
|
||||
isFetching={isFetching}
|
||||
isLoading={isLoading}
|
||||
error={error}
|
||||
height="100%"
|
||||
>
|
||||
<LoadingPanel data={data} isFetching={isFetching} isLoading={isLoading} error={error}>
|
||||
{data && <ListTable {...props} data={filteredData} renderLabel={renderLabel} />}
|
||||
{showMore && limit && (
|
||||
<Row justifyContent="center">
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ export function PageviewsChart({ data, unit, minDate, maxDate, ...props }: Pagev
|
|||
__id: new Date().getTime(),
|
||||
datasets: [
|
||||
{
|
||||
type: data.compare ? 'line' : 'bar',
|
||||
label: formatMessage(labels.visitors),
|
||||
data: generateTimeSeries(data.sessions, minDate, maxDate, unit, dateLocale),
|
||||
borderWidth: 1,
|
||||
|
|
@ -40,6 +41,7 @@ export function PageviewsChart({ data, unit, minDate, maxDate, ...props }: Pagev
|
|||
order: 3,
|
||||
},
|
||||
{
|
||||
type: data.compare ? 'line' : 'bar',
|
||||
label: formatMessage(labels.views),
|
||||
data: generateTimeSeries(data.pageviews, minDate, maxDate, unit, dateLocale),
|
||||
barPercentage: 0.9,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue