diff --git a/packages/identity-integration/src/flows/settings.flow.tsx b/packages/identity-integration/src/flows/settings.flow.tsx index 8cebcf0c..3146ea96 100644 --- a/packages/identity-integration/src/flows/settings.flow.tsx +++ b/packages/identity-integration/src/flows/settings.flow.tsx @@ -104,7 +104,13 @@ export const SettingsFlow: FC> = ({ ) .then(({ data }) => { setFlow(data) - router.push('/') + if (flow?.return_to) { + window.location.href = flow?.return_to + } else if (returnToUrl) { + router.push(returnToUrl) + } else { + router.replace(router.asPath) + } }) .catch(handleFlowError(router, 'settings', setFlow, returnToSettingsUrl)) .catch((error: AxiosError) => {