From 602b9a0dbd817be003307ab0e75b808e8a4e0fdc Mon Sep 17 00:00:00 2001 From: simeng-li Date: Thu, 15 Sep 2022 15:55:35 +0800 Subject: [PATCH] refactor(ui): refactor sign-social-call path name (#1931) align with the sign-in page's other path pattern --- packages/ui/src/App.tsx | 8 +++----- packages/ui/src/hooks/use-social-callback-handler.ts | 2 +- packages/ui/src/hooks/use-social.ts | 2 +- packages/ui/src/pages/SocialSignInCallback/index.test.tsx | 8 ++++---- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/ui/src/App.tsx b/packages/ui/src/App.tsx index d41b8556c..9cb7452ed 100644 --- a/packages/ui/src/App.tsx +++ b/packages/ui/src/App.tsx @@ -15,7 +15,7 @@ import SecondarySignIn from './pages/SecondarySignIn'; import SignIn from './pages/SignIn'; import SocialLanding from './pages/SocialLanding'; import SocialRegister from './pages/SocialRegister'; -import SocialSignInCallback from './pages/SocialSignInCallback'; +import SocialSignIn from './pages/SocialSignInCallback'; import getSignInExperienceSettings from './utils/sign-in-experience'; import './scss/normalized.scss'; @@ -58,15 +58,13 @@ const App = () => { }> } /> + } /> } /> } /> } /> {/* social sign-in pages */} - } - /> + } /> } /> } /> diff --git a/packages/ui/src/hooks/use-social-callback-handler.ts b/packages/ui/src/hooks/use-social-callback-handler.ts index c7b181059..9655ea34b 100644 --- a/packages/ui/src/hooks/use-social-callback-handler.ts +++ b/packages/ui/src/hooks/use-social-callback-handler.ts @@ -23,7 +23,7 @@ const useSocialCallbackHandler = () => { // Web flow navigate( { - pathname: `/social/sign-in-callback/${connectorId}`, + pathname: `/sign-in/social/${connectorId}`, search, }, { diff --git a/packages/ui/src/hooks/use-social.ts b/packages/ui/src/hooks/use-social.ts index 712bd129d..da23c402d 100644 --- a/packages/ui/src/hooks/use-social.ts +++ b/packages/ui/src/hooks/use-social.ts @@ -24,7 +24,7 @@ const useSocial = () => { : redirectTo; getLogtoNativeSdk()?.getPostMessage()({ - callbackUri: `${window.location.origin}/social/sign-in-callback/${connectorId}`, + callbackUri: `${window.location.origin}/sign-in/social/${connectorId}`, redirectTo: redirectUri, }); }, []); diff --git a/packages/ui/src/pages/SocialSignInCallback/index.test.tsx b/packages/ui/src/pages/SocialSignInCallback/index.test.tsx index 708ba3659..e73faf45e 100644 --- a/packages/ui/src/pages/SocialSignInCallback/index.test.tsx +++ b/packages/ui/src/pages/SocialSignInCallback/index.test.tsx @@ -23,9 +23,9 @@ describe('SocialCallbackPage with code', () => { Object.defineProperty(window, 'location', { value: { origin, - href: `/social/sign-in-callback?state=${state}&code=foo`, + href: `/sign-in/social/github?state=${state}&code=foo`, search: `?state=${state}&code=foo`, - pathname: '/social/sign-in-callback', + pathname: '/sign-in/social', replace: jest.fn(), }, }); @@ -33,9 +33,9 @@ describe('SocialCallbackPage with code', () => { renderWithPageContext( - + - } /> + } />