mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 00:27:11 +01:00
Convert all mutate to mutateAsync.
This commit is contained in:
parent
980e4e6b41
commit
6faf16e9aa
32 changed files with 78 additions and 97 deletions
|
|
@ -13,11 +13,11 @@ import { useMessages, useUpdateQuery } from '@/components/hooks';
|
|||
import { ROLES } from '@/lib/constants';
|
||||
|
||||
export function UserAddForm({ onSave, onClose }) {
|
||||
const { mutate, error, isPending } = useUpdateQuery(`/users`);
|
||||
const { mutateAsync, error, isPending } = useUpdateQuery(`/users`);
|
||||
const { formatMessage, labels, getErrorMessage } = useMessages();
|
||||
|
||||
const handleSubmit = async (data: any) => {
|
||||
mutate(data, {
|
||||
await mutateAsync(data, {
|
||||
onSuccess: async () => {
|
||||
onSave(data);
|
||||
onClose();
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ export function UserDeleteForm({
|
|||
onClose?: () => void;
|
||||
}) {
|
||||
const { messages, labels, formatMessage } = useMessages();
|
||||
const { mutate } = useDeleteQuery(`/users/${userId}`);
|
||||
const { mutateAsync } = useDeleteQuery(`/users/${userId}`);
|
||||
const { touch } = useModified();
|
||||
|
||||
const handleConfirm = async () => {
|
||||
mutate(null, {
|
||||
await mutateAsync(null, {
|
||||
onSuccess: async () => {
|
||||
touch('users');
|
||||
touch(`users:${userId}`);
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ export function UserEditForm({ userId, onSave }: { userId: string; onSave?: () =
|
|||
const user = useUser();
|
||||
const { user: login } = useLoginQuery();
|
||||
|
||||
const { mutate, error, toast, touch } = useUpdateQuery(`/users/${userId}`);
|
||||
const { mutateAsync, error, toast, touch } = useUpdateQuery(`/users/${userId}`);
|
||||
|
||||
const handleSubmit = async (data: any) => {
|
||||
mutate(data, {
|
||||
await mutateAsync(data, {
|
||||
onSuccess: async () => {
|
||||
toast(formatMessage(messages.saved));
|
||||
touch(`user:${user.id}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue