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: base url
shuai7946cea31d6e
diff --git a/ui/src/components/Share/index.tsx b/ui/src/components/Share/index.tsxindex 0cd46f36..203a72d6 100644--- a/ui/src/components/Share/index.tsx+++ b/ui/src/components/Share/index.tsx@@ -24,6 +24,7 @@ import { useTranslation } from 'react-i18next';import { FacebookShareButton, TwitterShareButton } from 'next-share';import copy from 'copy-to-clipboard';+import { BASE_ORIGIN } from '@/router/alias';import { loggedUserInfoStore } from '@/stores';interface IProps {@@ -42,8 +43,8 @@ const Index: FC<IProps> = ({ type, qid, aid, title }) => {const { t } = useTranslation();let baseUrl =type === 'question'- ? `${window.location.origin}/questions/${qid}`- : `${window.location.origin}/questions/${qid}/${aid}`;+ ? `${BASE_ORIGIN}/questions/${qid}`+ : `${BASE_ORIGIN}/questions/${qid}/${aid}`;if (user.id) {baseUrl = `${baseUrl}?shareUserId=${user.username}`;}diff --git a/ui/src/pages/Install/index.tsx b/ui/src/pages/Install/index.tsxindex 69723d29..39d24d09 100644--- a/ui/src/pages/Install/index.tsx+++ b/ui/src/pages/Install/index.tsx@@ -31,6 +31,7 @@ import {} from '@/services';import { Storage, handleFormError, scrollToDocTop } from '@/utils';import { CURRENT_LANG_STORAGE_KEY } from '@/common/constants';+import { BASE_ORIGIN } from '@/router/alias';import {FirstStep,@@ -94,7 +95,7 @@ const Index: FC = () => {errorMsg: '',},site_url: {- value: window.location.origin,+ value: BASE_ORIGIN,isInvalid: false,errorMsg: '',},diff --git a/ui/src/pages/Users/Logout/index.tsx b/ui/src/pages/Users/Logout/index.tsxindex 9da6e59d..5561c16f 100644--- a/ui/src/pages/Users/Logout/index.tsx+++ b/ui/src/pages/Users/Logout/index.tsx@@ -25,7 +25,7 @@ import { usePageTags } from '@/hooks';import { logout } from '@/services';import { loggedUserInfoStore } from '@/stores';import Storage from '@/utils/storage';-import { RouteAlias } from '@/router/alias';+import { RouteAlias, BASE_ORIGIN } from '@/router/alias';import { REDIRECT_PATH_STORAGE_KEY } from '@/common/constants';const Index = () => {@@ -43,7 +43,7 @@ const Index = () => {const redirect =Storage.get(REDIRECT_PATH_STORAGE_KEY) || RouteAlias.home;Storage.remove(REDIRECT_PATH_STORAGE_KEY);- window.location.replace(`${window.location.origin}${redirect}`);+ window.location.replace(`${BASE_ORIGIN}${redirect}`);});}// auto height of containerdiff --git a/ui/src/router/alias.ts b/ui/src/router/alias.tsindex 050f6c74..5f765b22 100644--- a/ui/src/router/alias.ts+++ b/ui/src/router/alias.ts@@ -19,6 +19,8 @@export const REACT_BASE_PATH = process.env.REACT_APP_BASE_URL || '';+export const BASE_ORIGIN = `${window.location.origin}${REACT_BASE_PATH}`;+export const RouteAlias = {home: '/',login: '/users/login',