diff --git a/ui/src/pages/Users/ActiveEmail/index.tsx b/ui/src/pages/Users/ActiveEmail/index.tsx index 177395d7..77a5afdf 100644 --- a/ui/src/pages/Users/ActiveEmail/index.tsx +++ b/ui/src/pages/Users/ActiveEmail/index.tsx @@ -1,6 +1,6 @@ import { FC, memo, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; -import { useSearchParams } from 'react-router-dom'; +import { useSearchParams, useNavigate } from 'react-router-dom'; import { loggedUserInfoStore } from '@/stores'; import { activateAccount } from '@/services'; @@ -10,6 +10,7 @@ const Index: FC = () => { const { t } = useTranslation('translation', { keyPrefix: 'page_title' }); const [searchParams] = useSearchParams(); const updateUser = loggedUserInfoStore((state) => state.update); + const navigate = useNavigate(); useEffect(() => { const code = searchParams.get('code'); @@ -17,9 +18,11 @@ const Index: FC = () => { activateAccount(encodeURIComponent(code)).then((res) => { updateUser(res); setTimeout(() => { - window.location.replace('/users/account-activation/success'); + navigate('/users/account-activation/success', { replace: true }); }, 0); }); + } else { + navigate('/', { replace: true }); } }, []); return ; diff --git a/ui/src/router/routes.ts b/ui/src/router/routes.ts index 7336b995..be7e61ac 100644 --- a/ui/src/router/routes.ts +++ b/ui/src/router/routes.ts @@ -167,13 +167,13 @@ const routes: RouteNode[] = [ { path: 'users/account-activation', page: 'pages/Users/ActiveEmail', - guard: async () => { - const notActivated = guard.notActivated(); - if (notActivated.ok) { - return notActivated; - } - return guard.notLogged(); - }, + // guard: async () => { + // const notActivated = guard.notActivated(); + // if (notActivated.ok) { + // return notActivated; + // } + // return guard.notLogged(); + // }, }, { path: 'users/account-activation/success', diff --git a/ui/src/utils/request.ts b/ui/src/utils/request.ts index 7d880bbf..aac4c149 100644 --- a/ui/src/utils/request.ts +++ b/ui/src/utils/request.ts @@ -103,6 +103,7 @@ class Request { return Promise.reject(false); } if (status === 403) { + debugger; // Permission interception if (data?.type === 'url_expired') { // url expired