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: error content support custome title
shuai2253a87aea22
diff --git a/ui/src/components/HttpErrorContent/index.tsx b/ui/src/components/HttpErrorContent/index.tsxindex c7efbb6e..8bd7cd98 100644--- a/ui/src/components/HttpErrorContent/index.tsx+++ b/ui/src/components/HttpErrorContent/index.tsx@@ -4,7 +4,12 @@ import { useTranslation } from 'react-i18next';import { usePageTags } from '@/hooks';-const Index = ({ httpCode = '', errMsg = '', showErrorCode = true }) => {+const Index = ({+ httpCode = '',+ title = '',+ errMsg = '',+ showErrorCode = true,+}) => {const { t } = useTranslation('translation', { keyPrefix: 'page_error' });useEffect(() => {// auto height of container@@ -34,6 +39,7 @@ const Index = ({ httpCode = '', errMsg = '', showErrorCode = true }) => {{showErrorCode && (<h4 className="text-center">{t('http_error', { code: httpCode })}</h4>)}+ {title && <h4 className="text-center">{title}</h4>}<div className="text-center mb-3 fs-5">{errMsg || t(`desc_${httpCode}`)}</div>diff --git a/ui/src/pages/50X/index.tsx b/ui/src/pages/50X/index.tsxindex 3dec9eee..bd956d77 100644--- a/ui/src/pages/50X/index.tsx+++ b/ui/src/pages/50X/index.tsx@@ -4,8 +4,16 @@ import { HttpErrorContent } from '@/components';const Index = () => {const [searchParams] = useSearchParams();- const msg = searchParams.get('msg') || '';- return <HttpErrorContent httpCode="50X" errMsg={msg} showErrorCode={!msg} />;+ const errMsg = searchParams.get('msg') || '';+ const title = searchParams.get('title') || '';+ return (+ <HttpErrorContent+ httpCode="50X"+ title={title}+ errMsg={errMsg}+ showErrorCode={!errMsg}+ />+ );};export default Index;