Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix(Header): Handling redirects when clicking on the `login` menu

haitaoo3e1e411dd0ae
diff --git a/ui/src/components/Header/index.tsx b/ui/src/components/Header/index.tsx
index 67706310..b1ed22d8 100644
--- a/ui/src/components/Header/index.tsx
+++ b/ui/src/components/Header/index.tsx
@@ -19,7 +19,7 @@ import {
import classnames from 'classnames';
-import { userCenter } from '@/utils';
+import { userCenter, floppyNavigation } from '@/utils';
import {
loggedUserInfoStore,
siteInfoStore,
@@ -152,6 +152,7 @@ const Header: FC = () => {
'link-light': navbarStyle === 'theme-colored',
'link-primary': navbarStyle !== 'theme-colored',
})}
+ onClick={() => floppyNavigation.storageLoginRedirect()}
href={userCenter.getLoginUrl()}>
{t('btns.login')}
</Button>
@@ -224,6 +225,7 @@ const Header: FC = () => {
'link-light': navbarStyle === 'theme-colored',
'link-primary': navbarStyle !== 'theme-colored',
})}
+ onClick={() => floppyNavigation.storageLoginRedirect()}
href={userCenter.getLoginUrl()}>
{t('btns.login')}
</Button>
diff --git a/ui/src/utils/floppyNavigation.ts b/ui/src/utils/floppyNavigation.ts
index 438958b4..6cdb1544 100644
--- a/ui/src/utils/floppyNavigation.ts
+++ b/ui/src/utils/floppyNavigation.ts
@@ -136,4 +136,5 @@ export const floppyNavigation = {
isRoutableLink,
handleRouteLinkClick,
equalToCurrentHref,
+ storageLoginRedirect,
};