diff --git a/pages/recovery.tsx b/pages/recovery.tsx index cd47d9f..a5df163 100644 --- a/pages/recovery.tsx +++ b/pages/recovery.tsx @@ -11,7 +11,7 @@ import { KernLogo } from "@/pkg/ui/Icons" const Recovery: NextPage = () => { const router = useRouter() - const { flow: flowId } = router.query + const { flow: flowId, return_to: returnTo } = router.query const [flow, setFlow] = useState() @@ -26,7 +26,7 @@ const Recovery: NextPage = () => { data = res.data } else { const res = await ory.createBrowserRecoveryFlow({ - returnTo: "/settings", + returnTo: returnTo ? String(returnTo) : undefined, }) data = res.data } @@ -56,7 +56,7 @@ const Recovery: NextPage = () => { } fetchFlow() - }, [router.isReady, flowId]) + }, [router.isReady, flowId, returnTo]) const onSubmit = (values: UpdateRecoveryFlowBody) => router