mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
14 lines
473 B
TypeScript
14 lines
473 B
TypeScript
import { useToast } from '@umami/react-zen';
|
|
import { useApi } from '../useApi';
|
|
import { useModified } from '../useModified';
|
|
|
|
export function useUpdateQuery(path: string, params?: Record<string, any>) {
|
|
const { post, useMutation } = useApi();
|
|
const query = useMutation({
|
|
mutationFn: (data: Record<string, any>) => post(path, { ...data, ...params }),
|
|
});
|
|
const { touch } = useModified();
|
|
const { toast } = useToast();
|
|
|
|
return { ...query, touch, toast };
|
|
}
|