mirror of
https://github.com/umami-software/umami.git
synced 2026-02-14 17:45:38 +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
|
|
@ -16,10 +16,10 @@ export function LinkDeleteButton({
|
|||
onSave?: () => void;
|
||||
}) {
|
||||
const { formatMessage, labels, getErrorMessage } = useMessages();
|
||||
const { mutate, isPending, error, touch } = useDeleteQuery(`/links/${linkId}`);
|
||||
const { mutateAsync, isPending, error, touch } = useDeleteQuery(`/links/${linkId}`);
|
||||
|
||||
const handleConfirm = (close: () => void) => {
|
||||
mutate(null, {
|
||||
const handleConfirm = async (close: () => void) => {
|
||||
await mutateAsync(null, {
|
||||
onSuccess: () => {
|
||||
touch('links');
|
||||
onSave?.();
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ export function LinkEditForm({
|
|||
onClose?: () => void;
|
||||
}) {
|
||||
const { formatMessage, labels, messages, getErrorMessage } = useMessages();
|
||||
const { mutate, error, isPending, touch, toast } = useUpdateQuery(
|
||||
const { mutateAsync, error, isPending, touch, toast } = useUpdateQuery(
|
||||
linkId ? `/links/${linkId}` : '/links',
|
||||
{
|
||||
id: linkId,
|
||||
|
|
@ -46,7 +46,7 @@ export function LinkEditForm({
|
|||
const [slug, setSlug] = useState(generateId());
|
||||
|
||||
const handleSubmit = async (data: any) => {
|
||||
mutate(data, {
|
||||
await mutateAsync(data, {
|
||||
onSuccess: async () => {
|
||||
toast(formatMessage(messages.saved));
|
||||
touch('links');
|
||||
|
|
@ -139,9 +139,7 @@ export function LinkEditForm({
|
|||
{formatMessage(labels.cancel)}
|
||||
</Button>
|
||||
)}
|
||||
<FormSubmitButton isDisabled={false} isLoading={isPending}>
|
||||
{formatMessage(labels.save)}
|
||||
</FormSubmitButton>
|
||||
<FormSubmitButton>{formatMessage(labels.save)}</FormSubmitButton>
|
||||
</Row>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue