From 2ed3e672deee1444b4d80f44d61d224780ec3a09 Mon Sep 17 00:00:00 2001 From: wangsijie Date: Thu, 30 Mar 2023 18:17:44 +0800 Subject: [PATCH] fix(console): remove url queries for social demo callback (#3621) --- .../src/cloud/pages/SocialDemoCallback/index.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/console/src/cloud/pages/SocialDemoCallback/index.tsx b/packages/console/src/cloud/pages/SocialDemoCallback/index.tsx index 2247e6f26..059e588de 100644 --- a/packages/console/src/cloud/pages/SocialDemoCallback/index.tsx +++ b/packages/console/src/cloud/pages/SocialDemoCallback/index.tsx @@ -1,5 +1,7 @@ import { Theme } from '@logto/schemas'; +import { useEffect } from 'react'; import { useTranslation } from 'react-i18next'; +import { useSearchParams } from 'react-router-dom'; import CongratsDark from '@/assets/images/congrats-dark.svg'; import Congrats from '@/assets/images/congrats.svg'; @@ -11,6 +13,14 @@ import * as styles from './index.module.scss'; function SocialDemoCallback() { const theme = useTheme(); const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); + const [searchParams, setSearchParams] = useSearchParams(); + + useEffect(() => { + // Social callback will have "code" in query params + if (searchParams.get('code')) { + setSearchParams({}, { replace: true }); + } + }, [searchParams, setSearchParams]); return (