From 8ccd37d7774103bee0d82cf8a2cef62b582f9262 Mon Sep 17 00:00:00 2001 From: guru_sainath Date: Wed, 12 Jun 2024 13:10:03 +0530 Subject: [PATCH] chore: handled next_path in auth wrapper (#4774) --- .../components/account/auth-forms/auth-root.tsx | 3 +++ .../components/account/auth-forms/password.tsx | 4 +++- .../account/auth-forms/unique-code.tsx | 4 +++- .../lib/wrappers/authentication-wrapper.tsx | 17 +++++++++-------- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/web/core/components/account/auth-forms/auth-root.tsx b/web/core/components/account/auth-forms/auth-root.tsx index 9c89d488f0..4f3bde94b9 100644 --- a/web/core/components/account/auth-forms/auth-root.tsx +++ b/web/core/components/account/auth-forms/auth-root.tsx @@ -41,6 +41,7 @@ export const AuthRoot: FC = observer((props) => { const invitation_id = searchParams.get("invitation_id"); const workspaceSlug = searchParams.get("slug"); const error_code = searchParams.get("error_code"); + const nextPath = searchParams.get("next_path"); // props const { authMode: currentAuthMode } = props; // states @@ -172,6 +173,7 @@ export const AuthRoot: FC = observer((props) => { email={email} handleEmailClear={handleEmailClear} generateEmailUniqueCode={generateEmailUniqueCode} + nextPath={nextPath || undefined} /> )} {authStep === EAuthSteps.PASSWORD && ( @@ -184,6 +186,7 @@ export const AuthRoot: FC = observer((props) => { if (step === EAuthSteps.UNIQUE_CODE) generateEmailUniqueCode(email); setAuthStep(step); }} + nextPath={nextPath || undefined} /> )} diff --git a/web/core/components/account/auth-forms/password.tsx b/web/core/components/account/auth-forms/password.tsx index cc8595a4cc..6437688e03 100644 --- a/web/core/components/account/auth-forms/password.tsx +++ b/web/core/components/account/auth-forms/password.tsx @@ -26,6 +26,7 @@ type Props = { mode: EAuthModes; handleEmailClear: () => void; handleAuthStep: (step: EAuthSteps) => void; + nextPath: string | undefined; }; type TPasswordFormValues = { @@ -42,7 +43,7 @@ const defaultValues: TPasswordFormValues = { const authService = new AuthService(); export const AuthPasswordForm: React.FC = observer((props: Props) => { - const { email, isSMTPConfigured, handleAuthStep, handleEmailClear, mode } = props; + const { email, isSMTPConfigured, handleAuthStep, handleEmailClear, mode, nextPath } = props; // hooks const { captureEvent } = useEventTracker(); // states @@ -120,6 +121,7 @@ export const AuthPasswordForm: React.FC = observer((props: Props) => { > + {nextPath && }