fix: update routing in user swap mutation to redirect to load-page
This commit is contained in:
parent
572a5420c1
commit
ee670581e7
4 changed files with 8 additions and 9 deletions
|
|
@ -27,8 +27,7 @@ export const UserViewHeader = () => {
|
|||
const { mutate: swap } = api.auth.swapUser.useMutation({
|
||||
onSuccess: async () => {
|
||||
toast.success("Utente cambiato con successo");
|
||||
await router.push("/area-riservata/dashboard");
|
||||
router.reload();
|
||||
await router.push("/area-riservata/load-page");
|
||||
},
|
||||
});
|
||||
const utils = api.useUtils();
|
||||
|
|
|
|||
|
|
@ -70,8 +70,7 @@ export default function ChatTopbar({
|
|||
const { mutate: swap } = api.auth.swapUser.useMutation({
|
||||
onSuccess: async () => {
|
||||
toast.success("Utente cambiato con successo");
|
||||
await router.push("/area-riservata/dashboard");
|
||||
router.reload();
|
||||
await router.push("/area-riservata/load-page");
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -41,12 +41,9 @@ type UserWChatInfo = Pick<
|
|||
export const UsersTable = (props: { data: UserWChatInfo[] }) => {
|
||||
const router = useRouter();
|
||||
const { mutateAsync: swap } = api.auth.swapUser.useMutation({
|
||||
onMutate: async () => {
|
||||
await router.push("/area-riservata/load-page");
|
||||
},
|
||||
onSuccess: async () => {
|
||||
toast.success("Utente cambiato con successo");
|
||||
window.location.replace("/area-riservata/dashboard");
|
||||
await router.push("/area-riservata/load-page");
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,16 @@
|
|||
import { useEffect } from "react";
|
||||
import { AreaRiservataLayout } from "~/components/Layout";
|
||||
import { LoadingPage } from "~/components/loading";
|
||||
import type { NextPageWithLayout } from "../_app";
|
||||
|
||||
const LoadPage: NextPageWithLayout = () => {
|
||||
useEffect(() => {
|
||||
window.location.replace("/area-riservata/dashboard");
|
||||
}, []);
|
||||
return <LoadingPage />;
|
||||
};
|
||||
export default LoadPage;
|
||||
|
||||
LoadPage.getLayout = function getLayout(page) {
|
||||
return <AreaRiservataLayout>{page}</AreaRiservataLayout>;
|
||||
return <AreaRiservataLayout noSidebar>{page}</AreaRiservataLayout>;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue