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: path exception when adding basepath
shuaief61261b460f
diff --git a/ui/src/pages/Install/components/FifthStep/index.tsx b/ui/src/pages/Install/components/FifthStep/index.tsxindex 4ec99a5c..7a9061f9 100644--- a/ui/src/pages/Install/components/FifthStep/index.tsx+++ b/ui/src/pages/Install/components/FifthStep/index.tsx@@ -21,7 +21,6 @@ import { FC } from 'react';import { Button } from 'react-bootstrap';import { useTranslation, Trans } from 'react-i18next';-import { REACT_BASE_PATH } from '@/router/alias';import Progress from '../Progress';interface Props {@@ -38,18 +37,15 @@ const Index: FC<Props> = ({ visible, siteUrl = '' }) => {<p><Trans i18nKey="install.ready_description">If you ever feel like changing more settings, visit- <a href={`${siteUrl}${REACT_BASE_PATH}/users/login`}>- {' '}- admin section- </a>- ; find it in the site menu.+ <a href={`${siteUrl}/users/login`}> admin section</a>; find it in the+ site menu.</Trans></p><p>{t('good_luck')}</p><div className="d-flex align-items-center justify-content-between"><Progress step={5} />- <Button href={`${siteUrl}${REACT_BASE_PATH}`}>{t('done')}</Button>+ <Button href={siteUrl}>{t('done')}</Button></div></div>);diff --git a/ui/src/pages/Users/Settings/Account/components/MyLogins/index.tsx b/ui/src/pages/Users/Settings/Account/components/MyLogins/index.tsxindex 353115f1..cd545d58 100644--- a/ui/src/pages/Users/Settings/Account/components/MyLogins/index.tsx+++ b/ui/src/pages/Users/Settings/Account/components/MyLogins/index.tsx@@ -27,6 +27,7 @@ import { useToast } from '@/hooks';import { base64ToSvg } from '@/utils';import Storage from '@/utils/storage';import { REDIRECT_PATH_STORAGE_KEY } from '@/common/constants';+import { REACT_BASE_PATH } from '@/router/alias';const Index = () => {const { data, mutate } = useOauthConnectorInfoByUser();@@ -42,7 +43,10 @@ const Index = () => {const deleteLogins = (e, item) => {if (!item.binding) {- Storage.set(REDIRECT_PATH_STORAGE_KEY, window.location.pathname);+ Storage.set(+ REDIRECT_PATH_STORAGE_KEY,+ window.location.pathname.replace(REACT_BASE_PATH, ''),+ );return;}e.preventDefault();diff --git a/ui/src/utils/floppyNavigation.ts b/ui/src/utils/floppyNavigation.tsindex 69ba4e88..9bdf7fd4 100644--- a/ui/src/utils/floppyNavigation.ts+++ b/ui/src/utils/floppyNavigation.ts@@ -75,7 +75,7 @@ const storageLoginRedirect = () => {const { pathname } = window.location;if (pathname !== RouteAlias.login && pathname !== RouteAlias.signUp) {const loc = window.location;- const redirectUrl = loc.href.replace(loc.origin, '');+ const redirectUrl = loc.href.replace(`${loc.origin}${REACT_BASE_PATH}`, '');Storage.set(REDIRECT_PATH_STORAGE_KEY, redirectUrl);}};diff --git a/ui/src/utils/request.ts b/ui/src/utils/request.tsindex 48f50e6e..c4070957 100644--- a/ui/src/utils/request.ts+++ b/ui/src/utils/request.ts@@ -31,6 +31,8 @@ import { floppyNavigation } from './floppyNavigation';import { isIgnoredPath, IGNORE_PATH_LIST } from './guard';const baseConfig = {+ baseURL:+ process.env.NODE_ENV === 'development' ? '' : process.env.REACT_APP_API_URL,timeout: 10000,withCredentials: true,};