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: rename linked page route

shuai6a0f9f15e564
diff --git a/ui/src/router/routes.ts b/ui/src/router/routes.ts
index 09ea4838..3ca8431f 100644
--- a/ui/src/router/routes.ts
+++ b/ui/src/router/routes.ts
@@ -117,7 +117,14 @@ const routes: RouteNode[] = [
page: 'pages/Questions/Detail',
},
{
- path: 'questions/linked/:qid',
+ path: '/questions/linked/:qid',
+ page: 'pages/Questions/Linked',
+ guard: () => {
+ return guard.linkedRedirect();
+ },
+ },
+ {
+ path: '/linked/:qid',
page: 'pages/Questions/Linked',
},
{
diff --git a/ui/src/utils/guard.ts b/ui/src/utils/guard.ts
index 59011017..24064669 100644
--- a/ui/src/utils/guard.ts
+++ b/ui/src/utils/guard.ts
@@ -400,6 +400,16 @@ export const askRedirect = () => {
};
};
+export const linkedRedirect = () => {
+ const queryString = window.location.search;
+ const pathname = window.location.pathname.replace('/questions', '');
+
+ return {
+ ok: false,
+ redirect: `${pathname}${queryString}`,
+ };
+};
+
let appInitialized = false;
export const setupApp = async () => {
/**