Convert all mutate to mutateAsync.

This commit is contained in:
Mike Cao 2025-09-22 22:39:25 -07:00
parent 980e4e6b41
commit 6faf16e9aa
32 changed files with 78 additions and 97 deletions

View file

@ -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?.();

View file

@ -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');