diff --git a/apps/infoalloggi/src/components/tables/users-table.tsx b/apps/infoalloggi/src/components/tables/users-table.tsx index dbc9ae8..0b51e92 100644 --- a/apps/infoalloggi/src/components/tables/users-table.tsx +++ b/apps/infoalloggi/src/components/tables/users-table.tsx @@ -41,11 +41,13 @@ type UserWChatInfo = Pick< export const UsersTable = (props: { data: UserWChatInfo[] }) => { const router = useRouter(); - const { mutate: swap } = api.auth.swapUser.useMutation({ + const { mutateAsync: swap } = api.auth.swapUser.useMutation({ + onMutate: async () => { + await router.push("/area-riservata/load-page"); + }, onSuccess: async () => { toast.success("Utente cambiato con successo"); - await router.push("/area-riservata/dashboard"); - router.reload(); + window.location.replace("/area-riservata/dashboard"); }, }); @@ -264,11 +266,7 @@ export const UsersTable = (props: { data: UserWChatInfo[] }) => {