redict
throw Something went wrong
#1676
-
How to safely redirect after query or mutation? In component.tsx if (mutation.isSuccess) {
throw redirect({
to: `/cop/${mutation.data.scan.unique_id}`,
});
} In mutation.ts file onSuccess: (data) => {
toast.success("Scan successful");
queryClient.invalidateQueries({ queryKey: ["scans"] });
throw redirect({ to: `/cop/${data.scan.unique_id}` });
}, Both options not work |
Beta Was this translation helpful? Give feedback.
Answered by
schiller-manuel
May 28, 2024
Replies: 1 comment 1 reply
-
instead of throwing a redirect you should const navigate = useNavigate()
navigate({ to : "..." }) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
daudln
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
instead of throwing a redirect you should