From c8d517da0e97e9a01b71bcce3cd9cc41814e15fd Mon Sep 17 00:00:00 2001 From: Nikita Elfimov Date: Tue, 26 Dec 2023 15:51:37 +0300 Subject: [PATCH] feat: refactor redirect flow of settings --- packages/identity-integration/src/flows/settings.flow.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) => {