diff --git a/src/app/(main)/admin/users/UserAddForm.tsx b/src/app/(main)/admin/users/UserAddForm.tsx
index f6881a10..fe7828c6 100644
--- a/src/app/(main)/admin/users/UserAddForm.tsx
+++ b/src/app/(main)/admin/users/UserAddForm.tsx
@@ -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();
diff --git a/src/app/(main)/admin/users/UserDeleteForm.tsx b/src/app/(main)/admin/users/UserDeleteForm.tsx
index f316dafe..8f6fd502 100644
--- a/src/app/(main)/admin/users/UserDeleteForm.tsx
+++ b/src/app/(main)/admin/users/UserDeleteForm.tsx
@@ -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}`);
diff --git a/src/app/(main)/admin/users/[userId]/UserEditForm.tsx b/src/app/(main)/admin/users/[userId]/UserEditForm.tsx
index 9a8d34cc..ac7875db 100644
--- a/src/app/(main)/admin/users/[userId]/UserEditForm.tsx
+++ b/src/app/(main)/admin/users/[userId]/UserEditForm.tsx
@@ -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}`);
diff --git a/src/app/(main)/boards/BoardAddForm.tsx b/src/app/(main)/boards/BoardAddForm.tsx
index fae3c70a..e0467082 100644
--- a/src/app/(main)/boards/BoardAddForm.tsx
+++ b/src/app/(main)/boards/BoardAddForm.tsx
@@ -13,10 +13,10 @@ export function BoardAddForm({
onClose?: () => void;
}) {
const { formatMessage, labels, messages } = useMessages();
- const { mutate, error, isPending } = useUpdateQuery('/websites', { teamId });
+ const { mutateAsync, error, isPending } = useUpdateQuery('/websites', { teamId });
const handleSubmit = async (data: any) => {
- mutate(data, {
+ await mutateAsync(data, {
onSuccess: async () => {
onSave?.();
onClose?.();
diff --git a/src/app/(main)/links/LinkDeleteButton.tsx b/src/app/(main)/links/LinkDeleteButton.tsx
index cfecb425..05a3217f 100644
--- a/src/app/(main)/links/LinkDeleteButton.tsx
+++ b/src/app/(main)/links/LinkDeleteButton.tsx
@@ -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?.();
diff --git a/src/app/(main)/links/LinkEditForm.tsx b/src/app/(main)/links/LinkEditForm.tsx
index ab1b0e40..36a11455 100644
--- a/src/app/(main)/links/LinkEditForm.tsx
+++ b/src/app/(main)/links/LinkEditForm.tsx
@@ -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)}
)}
-
- {formatMessage(labels.save)}
-
+ {formatMessage(labels.save)}
>
);
diff --git a/src/app/(main)/pixels/PixelDeleteButton.tsx b/src/app/(main)/pixels/PixelDeleteButton.tsx
index 0a81ab80..4e5024dd 100644
--- a/src/app/(main)/pixels/PixelDeleteButton.tsx
+++ b/src/app/(main)/pixels/PixelDeleteButton.tsx
@@ -14,11 +14,11 @@ export function PixelDeleteButton({
onSave?: () => void;
}) {
const { formatMessage, labels, getErrorMessage } = useMessages();
- const { mutate, isPending, error } = useDeleteQuery(`/pixels/${pixelId}`);
+ const { mutateAsync, isPending, error } = useDeleteQuery(`/pixels/${pixelId}`);
const { touch } = useModified();
const handleConfirm = (close: () => void) => {
- mutate(null, {
+ await mutateAsync(null, {
onSuccess: () => {
touch('pixels');
onSave?.();
diff --git a/src/app/(main)/pixels/PixelEditForm.tsx b/src/app/(main)/pixels/PixelEditForm.tsx
index b85d363b..9caae764 100644
--- a/src/app/(main)/pixels/PixelEditForm.tsx
+++ b/src/app/(main)/pixels/PixelEditForm.tsx
@@ -32,7 +32,7 @@ export function PixelEditForm({
onClose?: () => void;
}) {
const { formatMessage, labels, messages, getErrorMessage } = useMessages();
- const { mutate, error, isPending, touch, toast } = useUpdateQuery(
+ const { mutateAsync, error, isPending, touch, toast } = useUpdateQuery(
pixelId ? `/pixels/${pixelId}` : '/pixels',
{
id: pixelId,
@@ -45,7 +45,7 @@ export function PixelEditForm({
const [slug, setSlug] = useState(generateId());
const handleSubmit = async (data: any) => {
- mutate(data, {
+ await mutateAsync(data, {
onSuccess: async () => {
toast(formatMessage(messages.saved));
touch('pixels');
diff --git a/src/app/(main)/settings/profile/PasswordEditForm.tsx b/src/app/(main)/settings/profile/PasswordEditForm.tsx
index f0df01df..2c27a2d5 100644
--- a/src/app/(main)/settings/profile/PasswordEditForm.tsx
+++ b/src/app/(main)/settings/profile/PasswordEditForm.tsx
@@ -10,10 +10,10 @@ import { useMessages, useUpdateQuery } from '@/components/hooks';
export function PasswordEditForm({ onSave, onClose }) {
const { formatMessage, labels, messages, getErrorMessage } = useMessages();
- const { mutate, error, isPending } = useUpdateQuery('/me/password');
+ const { mutateAsync, error, isPending } = useUpdateQuery('/me/password');
const handleSubmit = async (data: any) => {
- mutate(data, {
+ await mutateAsync(data, {
onSuccess: async () => {
onSave();
onClose();
diff --git a/src/app/(main)/teams/TeamAddForm.tsx b/src/app/(main)/teams/TeamAddForm.tsx
index 68ff7978..87a6a4fd 100644
--- a/src/app/(main)/teams/TeamAddForm.tsx
+++ b/src/app/(main)/teams/TeamAddForm.tsx
@@ -10,10 +10,10 @@ import {
export function TeamAddForm({ onSave, onClose }: { onSave: () => void; onClose: () => void }) {
const { formatMessage, labels, getErrorMessage } = useMessages();
- const { mutate, error, isPending } = useUpdateQuery('/teams');
+ const { mutateAsync, error, isPending } = useUpdateQuery('/teams');
const handleSubmit = async (data: any) => {
- mutate(data, {
+ await mutateAsync(data, {
onSuccess: async () => {
onSave?.();
onClose?.();
diff --git a/src/app/(main)/teams/TeamJoinForm.tsx b/src/app/(main)/teams/TeamJoinForm.tsx
index f69099ed..0c896747 100644
--- a/src/app/(main)/teams/TeamJoinForm.tsx
+++ b/src/app/(main)/teams/TeamJoinForm.tsx
@@ -10,10 +10,10 @@ import { useMessages, useUpdateQuery } from '@/components/hooks';
export function TeamJoinForm({ onSave, onClose }: { onSave: () => void; onClose: () => void }) {
const { formatMessage, labels, getErrorMessage } = useMessages();
- const { mutate, error, isPending, touch } = useUpdateQuery('/teams/join');
+ const { mutateAsync, error, touch } = useUpdateQuery('/teams/join');
const handleSubmit = async (data: any) => {
- mutate(data, {
+ await mutateAsync(data, {
onSuccess: async () => {
touch('teams:members');
onSave?.();
@@ -33,9 +33,7 @@ export function TeamJoinForm({ onSave, onClose }: { onSave: () => void; onClose:
-
- {formatMessage(labels.join)}
-
+ {formatMessage(labels.join)}
);
diff --git a/src/app/(main)/teams/TeamLeaveForm.tsx b/src/app/(main)/teams/TeamLeaveForm.tsx
index 2c7a41d2..c8063365 100644
--- a/src/app/(main)/teams/TeamLeaveForm.tsx
+++ b/src/app/(main)/teams/TeamLeaveForm.tsx
@@ -15,11 +15,11 @@ export function TeamLeaveForm({
onClose: () => void;
}) {
const { formatMessage, labels, messages, getErrorMessage } = useMessages();
- const { mutate, error, isPending } = useDeleteQuery(`/teams/${teamId}/users/${userId}`);
+ const { mutateAsync, error, isPending } = useDeleteQuery(`/teams/${teamId}/users/${userId}`);
const { touch } = useModified();
const handleConfirm = async () => {
- mutate(null, {
+ await mutateAsync(null, {
onSuccess: async () => {
touch('teams:members');
onSave();
diff --git a/src/app/(main)/teams/[teamId]/TeamDeleteForm.tsx b/src/app/(main)/teams/[teamId]/TeamDeleteForm.tsx
index 3634af56..cf1ce618 100644
--- a/src/app/(main)/teams/[teamId]/TeamDeleteForm.tsx
+++ b/src/app/(main)/teams/[teamId]/TeamDeleteForm.tsx
@@ -13,10 +13,10 @@ export function TeamDeleteForm({
onClose?: () => void;
}) {
const { labels, formatMessage, getErrorMessage } = useMessages();
- const { mutate, error, isPending, touch } = useDeleteQuery(`/teams/${teamId}`);
+ const { mutateAsync, error, isPending, touch } = useDeleteQuery(`/teams/${teamId}`);
const handleConfirm = async () => {
- mutate(null, {
+ await mutateAsync(null, {
onSuccess: async () => {
touch('teams');
onSave?.();
diff --git a/src/app/(main)/teams/[teamId]/TeamEditForm.tsx b/src/app/(main)/teams/[teamId]/TeamEditForm.tsx
index 2b6690ff..debea5d4 100644
--- a/src/app/(main)/teams/[teamId]/TeamEditForm.tsx
+++ b/src/app/(main)/teams/[teamId]/TeamEditForm.tsx
@@ -25,10 +25,10 @@ export function TeamEditForm({
const team = useTeam();
const { formatMessage, labels, messages, getErrorMessage } = useMessages();
- const { mutate, error, isPending, touch, toast } = useUpdateQuery(`/teams/${teamId}`);
+ const { mutateAsync, error, isPending, touch, toast } = useUpdateQuery(`/teams/${teamId}`);
const handleSubmit = async (data: any) => {
- mutate(data, {
+ await mutateAsync(data, {
onSuccess: async () => {
toast(formatMessage(messages.saved));
touch('teams');
diff --git a/src/app/(main)/teams/[teamId]/TeamMemberEditForm.tsx b/src/app/(main)/teams/[teamId]/TeamMemberEditForm.tsx
index e64a9b27..76f0800f 100644
--- a/src/app/(main)/teams/[teamId]/TeamMemberEditForm.tsx
+++ b/src/app/(main)/teams/[teamId]/TeamMemberEditForm.tsx
@@ -23,11 +23,11 @@ export function TeamMemberEditForm({
onSave?: () => void;
onClose?: () => void;
}) {
- const { mutate, error, isPending } = useUpdateQuery(`/teams/${teamId}/users/${userId}`);
+ const { mutateAsync, error, isPending } = useUpdateQuery(`/teams/${teamId}/users/${userId}`);
const { formatMessage, labels, getErrorMessage } = useMessages();
const handleSubmit = async (data: any) => {
- mutate(data, {
+ await mutateAsync(data, {
onSuccess: async () => {
onSave();
onClose();
diff --git a/src/app/(main)/teams/[teamId]/TeamMemberRemoveButton.tsx b/src/app/(main)/teams/[teamId]/TeamMemberRemoveButton.tsx
index 66d540b0..708f8a27 100644
--- a/src/app/(main)/teams/[teamId]/TeamMemberRemoveButton.tsx
+++ b/src/app/(main)/teams/[teamId]/TeamMemberRemoveButton.tsx
@@ -18,11 +18,11 @@ export function TeamMemberRemoveButton({
onSave?: () => void;
}) {
const { formatMessage, labels } = useMessages();
- const { mutate, isPending, error } = useDeleteQuery(`/teams/${teamId}/users/${userId}`);
+ const { mutateAsync, isPending, error } = useDeleteQuery(`/teams/${teamId}/users/${userId}`);
const { touch } = useModified();
const handleConfirm = (close: () => void) => {
- mutate(null, {
+ await mutateAsync(null, {
onSuccess: () => {
touch('teams:members');
onSave?.();
diff --git a/src/app/(main)/teams/[teamId]/TeamWebsiteRemoveButton.tsx b/src/app/(main)/teams/[teamId]/TeamWebsiteRemoveButton.tsx
index 34e8184e..c3a68c57 100644
--- a/src/app/(main)/teams/[teamId]/TeamWebsiteRemoveButton.tsx
+++ b/src/app/(main)/teams/[teamId]/TeamWebsiteRemoveButton.tsx
@@ -1,13 +1,13 @@
import { useDeleteQuery, useMessages } from '@/components/hooks';
import { Icon, LoadingButton, Text } from '@umami/react-zen';
-import { Close } from '@/components/icons';
+import { X } from '@/components/icons';
export function TeamWebsiteRemoveButton({ teamId, websiteId, onSave }) {
const { formatMessage, labels } = useMessages();
- const { mutate, isPending } = useDeleteQuery(`/teams/${teamId}/websites/${websiteId}`);
+ const { mutateAsync } = useDeleteQuery(`/teams/${teamId}/websites/${websiteId}`);
const handleRemoveTeamMember = async () => {
- mutate(null, {
+ await mutateAsync(null, {
onSuccess: () => {
onSave();
},
@@ -15,9 +15,9 @@ export function TeamWebsiteRemoveButton({ teamId, websiteId, onSave }) {
};
return (
- handleRemoveTeamMember()} isLoading={isPending}>
+ handleRemoveTeamMember()}>
-
+
{formatMessage(labels.remove)}
diff --git a/src/app/(main)/websites/WebsiteAddForm.tsx b/src/app/(main)/websites/WebsiteAddForm.tsx
index e2be2563..b8ff7b45 100644
--- a/src/app/(main)/websites/WebsiteAddForm.tsx
+++ b/src/app/(main)/websites/WebsiteAddForm.tsx
@@ -13,10 +13,10 @@ export function WebsiteAddForm({
onClose?: () => void;
}) {
const { formatMessage, labels, messages } = useMessages();
- const { mutate, error, isPending } = useUpdateQuery('/websites', { teamId });
+ const { mutateAsync, error, isPending } = useUpdateQuery('/websites', { teamId });
const handleSubmit = async (data: any) => {
- mutate(data, {
+ await mutateAsync(data, {
onSuccess: async () => {
onSave?.();
onClose?.();
diff --git a/src/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelEditForm.tsx b/src/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelEditForm.tsx
index 01940beb..30976bff 100644
--- a/src/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelEditForm.tsx
+++ b/src/app/(main)/websites/[websiteId]/(reports)/funnels/FunnelEditForm.tsx
@@ -33,12 +33,10 @@ export function FunnelEditForm({
}) {
const { formatMessage, labels } = useMessages();
const { data } = useReportQuery(id);
- const { mutate, error, isPending, touch } = useUpdateQuery(`/reports${id ? `/${id}` : ''}`);
+ const { mutateAsync, error, isPending, touch } = useUpdateQuery(`/reports${id ? `/${id}` : ''}`);
const handleSubmit = async ({ name, ...parameters }) => {
- //
-
- mutate(
+ await mutateAsync(
{ ...data, id, name, type: 'funnel', websiteId, parameters },
{
onSuccess: async () => {
diff --git a/src/app/(main)/websites/[websiteId]/(reports)/goals/GoalEditForm.tsx b/src/app/(main)/websites/[websiteId]/(reports)/goals/GoalEditForm.tsx
index 2264ccf8..394cdec9 100644
--- a/src/app/(main)/websites/[websiteId]/(reports)/goals/GoalEditForm.tsx
+++ b/src/app/(main)/websites/[websiteId]/(reports)/goals/GoalEditForm.tsx
@@ -27,10 +27,10 @@ export function GoalEditForm({
}) {
const { formatMessage, labels } = useMessages();
const { data } = useReportQuery(id);
- const { mutate, error, isPending, touch } = useUpdateQuery(`/reports${id ? `/${id}` : ''}`);
+ const { mutateAsync, error, isPending, touch } = useUpdateQuery(`/reports${id ? `/${id}` : ''}`);
const handleSubmit = async (formData: Record) => {
- mutate(
+ await mutateAsync(
{ ...formData, type: 'goal', websiteId },
{
onSuccess: async () => {
diff --git a/src/app/(main)/websites/[websiteId]/cohorts/CohortDeleteButton.tsx b/src/app/(main)/websites/[websiteId]/cohorts/CohortDeleteButton.tsx
index 9e56a875..7b7d0d1c 100644
--- a/src/app/(main)/websites/[websiteId]/cohorts/CohortDeleteButton.tsx
+++ b/src/app/(main)/websites/[websiteId]/cohorts/CohortDeleteButton.tsx
@@ -17,12 +17,12 @@ export function CohortDeleteButton({
onSave?: () => void;
}) {
const { formatMessage, labels } = useMessages();
- const { mutate, isPending, error, touch } = useDeleteQuery(
+ const { mutateAsync, isPending, error, touch } = useDeleteQuery(
`/websites/${websiteId}/segments/${cohortId}`,
);
const handleConfirm = (close: () => void) => {
- mutate(null, {
+ await mutateAsync(null, {
onSuccess: () => {
touch('cohorts');
onSave?.();
diff --git a/src/app/(main)/websites/[websiteId]/cohorts/CohortEditForm.tsx b/src/app/(main)/websites/[websiteId]/cohorts/CohortEditForm.tsx
index c02d85c9..3b228e83 100644
--- a/src/app/(main)/websites/[websiteId]/cohorts/CohortEditForm.tsx
+++ b/src/app/(main)/websites/[websiteId]/cohorts/CohortEditForm.tsx
@@ -33,7 +33,7 @@ export function CohortEditForm({
const { data } = useWebsiteCohortQuery(websiteId, cohortId);
const { formatMessage, labels, messages, getErrorMessage } = useMessages();
- const { mutate, error, isPending, touch, toast } = useUpdateQuery(
+ const { mutateAsync, error, isPending, touch, toast } = useUpdateQuery(
`/websites/${websiteId}/segments${cohortId ? `/${cohortId}` : ''}`,
{
type: 'cohort',
@@ -41,7 +41,7 @@ export function CohortEditForm({
);
const handleSubmit = async (formData: any) => {
- mutate(formData, {
+ await mutateAsync(formData, {
onSuccess: async () => {
toast(formatMessage(messages.saved));
touch('cohorts');
diff --git a/src/app/(main)/websites/[websiteId]/segments/SegmentDeleteButton.tsx b/src/app/(main)/websites/[websiteId]/segments/SegmentDeleteButton.tsx
index f212187b..2dd5e105 100644
--- a/src/app/(main)/websites/[websiteId]/segments/SegmentDeleteButton.tsx
+++ b/src/app/(main)/websites/[websiteId]/segments/SegmentDeleteButton.tsx
@@ -17,12 +17,12 @@ export function SegmentDeleteButton({
onSave?: () => void;
}) {
const { formatMessage, labels } = useMessages();
- const { mutate, isPending, error, touch } = useDeleteQuery(
+ const { mutateAsync, isPending, error, touch } = useDeleteQuery(
`/websites/${websiteId}/segments/${segmentId}`,
);
const handleConfirm = (close: () => void) => {
- mutate(null, {
+ await mutateAsync(null, {
onSuccess: () => {
touch('segments');
onSave?.();
diff --git a/src/app/(main)/websites/[websiteId]/segments/SegmentEditForm.tsx b/src/app/(main)/websites/[websiteId]/segments/SegmentEditForm.tsx
index 32b7ee93..26b97352 100644
--- a/src/app/(main)/websites/[websiteId]/segments/SegmentEditForm.tsx
+++ b/src/app/(main)/websites/[websiteId]/segments/SegmentEditForm.tsx
@@ -30,7 +30,7 @@ export function SegmentEditForm({
const { data } = useWebsiteSegmentQuery(websiteId, segmentId);
const { formatMessage, labels, getErrorMessage } = useMessages();
- const { mutate, error, isPending, touch, toast } = useUpdateQuery(
+ const { mutateAsync, error, isPending, touch, toast } = useUpdateQuery(
`/websites/${websiteId}/segments${segmentId ? `/${segmentId}` : ''}`,
{
type: 'segment',
@@ -38,7 +38,7 @@ export function SegmentEditForm({
);
const handleSubmit = async (formData: any) => {
- mutate(formData, {
+ await mutateAsync(formData, {
onSuccess: async () => {
toast(formatMessage(messages.saved));
touch('segments');
diff --git a/src/app/(main)/websites/[websiteId]/settings/WebsiteDeleteForm.tsx b/src/app/(main)/websites/[websiteId]/settings/WebsiteDeleteForm.tsx
index a123813d..780aab74 100644
--- a/src/app/(main)/websites/[websiteId]/settings/WebsiteDeleteForm.tsx
+++ b/src/app/(main)/websites/[websiteId]/settings/WebsiteDeleteForm.tsx
@@ -13,10 +13,10 @@ export function WebsiteDeleteForm({
onClose?: () => void;
}) {
const { formatMessage, labels } = useMessages();
- const { mutate, isPending, error, touch } = useDeleteQuery(`/websites/${websiteId}`);
+ const { mutateAsync, isPending, error, touch } = useDeleteQuery(`/websites/${websiteId}`);
const handleConfirm = async () => {
- mutate(null, {
+ await mutateAsync(null, {
onSuccess: async () => {
touch('websites');
touch(`websites:${websiteId}`);
diff --git a/src/app/(main)/websites/[websiteId]/settings/WebsiteEditForm.tsx b/src/app/(main)/websites/[websiteId]/settings/WebsiteEditForm.tsx
index e79ec922..50598199 100644
--- a/src/app/(main)/websites/[websiteId]/settings/WebsiteEditForm.tsx
+++ b/src/app/(main)/websites/[websiteId]/settings/WebsiteEditForm.tsx
@@ -5,10 +5,10 @@ import { DOMAIN_REGEX } from '@/lib/constants';
export function WebsiteEditForm({ websiteId, onSave }: { websiteId: string; onSave?: () => void }) {
const website = useWebsite();
const { formatMessage, labels, messages, getErrorMessage } = useMessages();
- const { mutate, error, touch, toast, isPending } = useUpdateQuery(`/websites/${websiteId}`);
+ const { mutateAsync, error, touch, toast } = useUpdateQuery(`/websites/${websiteId}`);
const handleSubmit = async (data: any) => {
- mutate(data, {
+ await mutateAsync(data, {
onSuccess: async () => {
toast(formatMessage(messages.saved));
touch(`website:${website.id}`);
@@ -45,12 +45,7 @@ export function WebsiteEditForm({ websiteId, onSave }: { websiteId: string; onSa
-
+
{formatMessage(labels.save)}
diff --git a/src/app/(main)/websites/[websiteId]/settings/WebsiteResetForm.tsx b/src/app/(main)/websites/[websiteId]/settings/WebsiteResetForm.tsx
index 3c990ded..43583c3e 100644
--- a/src/app/(main)/websites/[websiteId]/settings/WebsiteResetForm.tsx
+++ b/src/app/(main)/websites/[websiteId]/settings/WebsiteResetForm.tsx
@@ -13,10 +13,10 @@ export function WebsiteResetForm({
onClose?: () => void;
}) {
const { formatMessage, labels } = useMessages();
- const { mutate, isPending, error } = useUpdateQuery(`/websites/${websiteId}/reset`);
+ const { mutateAsync, isPending, error } = useUpdateQuery(`/websites/${websiteId}/reset`);
const handleConfirm = async () => {
- mutate(null, {
+ await mutateAsync(null, {
onSuccess: async () => {
onSave?.();
onClose?.();
diff --git a/src/app/(main)/websites/[websiteId]/settings/WebsiteShareForm.tsx b/src/app/(main)/websites/[websiteId]/settings/WebsiteShareForm.tsx
index f828d9e1..dc2fe689 100644
--- a/src/app/(main)/websites/[websiteId]/settings/WebsiteShareForm.tsx
+++ b/src/app/(main)/websites/[websiteId]/settings/WebsiteShareForm.tsx
@@ -25,7 +25,7 @@ export interface WebsiteShareFormProps {
export function WebsiteShareForm({ websiteId, shareId, onSave, onClose }: WebsiteShareFormProps) {
const { formatMessage, labels, messages, getErrorMessage } = useMessages();
const [id, setId] = useState(shareId);
- const { mutate, error, isPending, touch, toast } = useUpdateQuery(`/websites/${websiteId}`);
+ const { mutateAsync, error, touch, toast } = useUpdateQuery(`/websites/${websiteId}`);
const url = `${window?.location.origin || ''}${process.env.basePath || ''}/share/${id}`;
@@ -37,11 +37,11 @@ export function WebsiteShareForm({ websiteId, shareId, onSave, onClose }: Websit
setId(id ? null : generateId());
};
- const handleSave = () => {
+ const handleSave = async () => {
const data = {
shareId: id,
};
- mutate(data, {
+ await mutateAsync(data, {
onSuccess: async () => {
toast(formatMessage(messages.saved));
touch(`website:${websiteId}`);
@@ -69,9 +69,7 @@ export function WebsiteShareForm({ websiteId, shareId, onSave, onClose }: Websit
{onClose && }
-
- {formatMessage(labels.save)}
-
+ {formatMessage(labels.save)}
diff --git a/src/app/(main)/websites/[websiteId]/settings/WebsiteTransferForm.tsx b/src/app/(main)/websites/[websiteId]/settings/WebsiteTransferForm.tsx
index f7461a44..9752a48e 100644
--- a/src/app/(main)/websites/[websiteId]/settings/WebsiteTransferForm.tsx
+++ b/src/app/(main)/websites/[websiteId]/settings/WebsiteTransferForm.tsx
@@ -32,7 +32,7 @@ export function WebsiteTransferForm({
const website = useWebsite();
const [teamId, setTeamId] = useState(null);
const { formatMessage, labels, messages, getErrorMessage } = useMessages();
- const { mutate, error, isPending } = useUpdateQuery(`/websites/${websiteId}/transfer`);
+ const { mutateAsync, error, isPending } = useUpdateQuery(`/websites/${websiteId}/transfer`);
const { data: teams, isLoading } = useUserTeamsQuery(user.id);
const isTeamWebsite = !!website?.teamId;
@@ -45,7 +45,7 @@ export function WebsiteTransferForm({
) || [];
const handleSubmit = async () => {
- mutate(
+ await mutateAsync(
{
userId: website.teamId ? user.id : undefined,
teamId: website.userId ? teamId : undefined,
diff --git a/src/app/login/LoginForm.tsx b/src/app/login/LoginForm.tsx
index 3dcbadef..90ac981a 100644
--- a/src/app/login/LoginForm.tsx
+++ b/src/app/login/LoginForm.tsx
@@ -18,10 +18,10 @@ import { LogoSvg } from '@/components/icons';
export function LoginForm() {
const { formatMessage, labels, getErrorMessage } = useMessages();
const router = useRouter();
- const { mutate, error, isPending } = useUpdateQuery('/auth/login');
+ const { mutateAsync, error } = useUpdateQuery('/auth/login');
const handleSubmit = async (data: any) => {
- mutate(data, {
+ await mutateAsync(data, {
onSuccess: async ({ token, user }) => {
setClientAuthToken(token);
setUser(user);
@@ -55,13 +55,7 @@ export function LoginForm() {
-
+
{formatMessage(labels.login)}
diff --git a/src/components/input/ReportEditButton.tsx b/src/components/input/ReportEditButton.tsx
index 38fa17dd..8f0c7a3c 100644
--- a/src/components/input/ReportEditButton.tsx
+++ b/src/components/input/ReportEditButton.tsx
@@ -31,7 +31,7 @@ export function ReportEditButton({
const { formatMessage, labels, messages } = useMessages();
const [showEdit, setShowEdit] = useState(false);
const [showDelete, setShowDelete] = useState(false);
- const { mutate, touch } = useDeleteQuery(`/reports/${id}`);
+ const { mutateAsync, touch } = useDeleteQuery(`/reports/${id}`);
const handleAction = (id: any) => {
if (id === 'edit') {
@@ -47,7 +47,7 @@ export function ReportEditButton({
};
const handleDelete = async () => {
- mutate(null, {
+ await mutateAsync(null, {
onSuccess: async () => {
touch(`reports:${type}`);
setShowDelete(false);
diff --git a/src/components/input/SettingsButton.tsx b/src/components/input/SettingsButton.tsx
index 68fd2cdc..9afe6e0b 100644
--- a/src/components/input/SettingsButton.tsx
+++ b/src/components/input/SettingsButton.tsx
@@ -19,14 +19,14 @@ export function SettingsButton() {
const { cloudMode } = useConfig();
const handleAction = (id: Key) => {
- if (id === 'settings') {
- if (cloudMode) {
- window.location.href = `/settings`;
- return;
- }
+ const url = `/${id}`;
+
+ if (cloudMode) {
+ window.location.href = url;
+ return;
}
- router.push(renderUrl(`/${id}`));
+ router.push(renderUrl(url));
};
return (